Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(487)

Unified Diff: sdk/lib/io/http.dart

Issue 11553027: Add client certificates to HttpsServer and HttpClient. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Remove two stray lines. Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/bin/secure_socket.cc ('k') | sdk/lib/io/http_impl.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/io/http.dart
diff --git a/sdk/lib/io/http.dart b/sdk/lib/io/http.dart
index 24cb85b8c54418e922a1f740d3c08ce18a4b927f..4a0fbef6907ca8f2c8ab464ad1689702fbecaf1a 100644
--- a/sdk/lib/io/http.dart
+++ b/sdk/lib/io/http.dart
@@ -63,15 +63,16 @@ abstract class HttpServer {
* [port]. If a [port] of 0 is specified the server will choose an
* ephemeral port. The optional argument [backlog] can be used to
* specify the listen backlog for the underlying OS listen.
- * The optional argument [certificate_name] is used by the HttpsServer
- * class, which shares the same interface.
+ * The optional arguments [certificate_name] and [requestClientCertificate]
+ * are used by the HttpsServer class, which shares the same interface.
* See [addRequestHandler] and [defaultRequestHandler] for
* information on how incoming HTTP requests are handled.
*/
void listen(String host,
int port,
{int backlog: 128,
- String certificate_name});
+ String certificate_name,
+ bool requestClientCertificate: false});
/**
* Attach the HTTP server to an existing [:ServerSocket:]. If the
@@ -637,6 +638,14 @@ abstract class HttpRequest {
List<Cookie> get cookies;
/**
+ * Returns the client certificate of the client making the request.
+ * Returns null if the connection is not a secure TLS or SSL connection,
+ * or if the server does not request a client certificate, or if the client
+ * does not provide one.
+ */
+ X509Certificate get certificate;
+
+ /**
* Returns, or initialize, a session for the given request. If the session is
* being initialized by this call, [init] will be called with the
* newly create session. Here the [:HttpSession.data:] field can be set, if
@@ -821,6 +830,23 @@ abstract class HttpClient {
void addCredentials(Uri url, String realm, HttpClientCredentials credentials);
/**
+ * If [sendClientCertificate] is set to true, authenticate with a client
+ * certificate when connecting with an HTTPS server that requests one.
+ * Select the certificate from the certificate database that matches
+ * the authorities listed by the HTTPS server as valid.
+ * If [clientCertificate] is set, send the certificate with that nickname
+ * instead.
+ */
+ set sendClientCertificate(bool send);
+
+ /**
+ * If [clientCertificate] is non-null and [sendClientCertificate] is true,
+ * use [clientCertificate] to select the certificate to send from the
+ * certificate database, looking it up by its nickname.
+ */
+ set clientCertificate(String nickname);
+
+ /**
* Sets the function used to resolve the proxy server to be used for
* opening a HTTP connection to the specified [url]. If this
* function is not set, direct connections will always be used.
@@ -1036,6 +1062,12 @@ abstract class HttpClientResponse {
List<Cookie> get cookies;
/**
+ * Returns the certificate of the HTTPS server providing the response.
+ * Returns null if the connection is not a secure TLS or SSL connection.
+ */
+ X509Certificate get certificate;
+
+ /**
* Returns the input stream for the response. This is used to read
* the response data.
*/
« no previous file with comments | « runtime/bin/secure_socket.cc ('k') | sdk/lib/io/http_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698