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

Side by Side Diff: sdk/lib/io/http.dart

Issue 22816008: dart:io | Add badCertificateCallback to HttpClient. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 4 months 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | sdk/lib/io/http_impl.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of dart.io; 5 part of dart.io;
6 6
7 /** 7 /**
8 * HTTP status codes. 8 * HTTP status codes.
9 */ 9 */
10 abstract class HttpStatus { 10 abstract class HttpStatus {
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 * 135 *
136 * If [port] has the value [:0:] an ephemeral port will be chosen by 136 * If [port] has the value [:0:] an ephemeral port will be chosen by
137 * the system. The actual port used can be retrieved using the 137 * the system. The actual port used can be retrieved using the
138 * [port] getter. 138 * [port] getter.
139 * 139 *
140 * The optional argument [backlog] can be used to specify the listen 140 * The optional argument [backlog] can be used to specify the listen
141 * backlog for the underlying OS listen setup. If [backlog] has the 141 * backlog for the underlying OS listen setup. If [backlog] has the
142 * value of [:0:] (the default) a reasonable value will be chosen by 142 * value of [:0:] (the default) a reasonable value will be chosen by
143 * the system. 143 * the system.
144 * 144 *
145 * The certificate with Distinguished Name [certificateName] is looked 145 * The certificate with nickname or distinguished name (DN) [certificateName]
146 * up in the certificate database, and is used as the server certificate. 146 * is looked up in the certificate database, and is used as the server
147 * if [requestClientCertificate] is true, the server will request clients 147 * certificate. If [requestClientCertificate] is true, the server will
148 * to authenticate with a client certificate. 148 * request clients to authenticate with a client certificate.
149 */ 149 */
150 150
151 static Future<HttpServer> bindSecure(address, 151 static Future<HttpServer> bindSecure(address,
152 int port, 152 int port,
153 {int backlog: 0, 153 {int backlog: 0,
154 String certificateName, 154 String certificateName,
155 bool requestClientCertificate: false}) 155 bool requestClientCertificate: false})
156 => _HttpServer.bindSecure(address, 156 => _HttpServer.bindSecure(address,
157 port, 157 port,
158 backlog, 158 backlog,
(...skipping 1006 matching lines...) Expand 10 before | Expand all | Expand 10 after
1165 1165
1166 /** 1166 /**
1167 * Add credentials to be used for authorizing HTTP proxies. 1167 * Add credentials to be used for authorizing HTTP proxies.
1168 */ 1168 */
1169 void addProxyCredentials(String host, 1169 void addProxyCredentials(String host,
1170 int port, 1170 int port,
1171 String realm, 1171 String realm,
1172 HttpClientCredentials credentials); 1172 HttpClientCredentials credentials);
1173 1173
1174 /** 1174 /**
1175 * Set a callback that will decide whether to accept a secure connection
1176 * with a server certificate that cannot be authenticated by any of our
1177 * trusted root certificates.
1178 *
1179 * The callback takes an [X509Certificate] object and the server's hostname
1180 * and port, and returns true if the connection should be accepted.
1181 * If the callback returns true, the future completes
Søren Gjesse 2013/08/13 16:56:08 "the future" - please be more specific to what fut
Bill Hesse 2013/08/14 09:25:48 Done.
1182 * with an HttpRequest object. Otherwise, the future completes with an error.
Søren Gjesse 2013/08/13 16:56:08 Maybe mention explicitly that "otherwise" includes
Bill Hesse 2013/08/14 09:25:48 Done.
1183 *
1184 * Each [open] or [get] call uses the value of badCertificateCallback
Søren Gjesse 2013/08/13 16:56:08 We have all of open, openUrl, get, getUrl, port, p
Bill Hesse 2013/08/14 09:25:48 Done.
1185 * at the time the call is made, to handle a bad certificate that is received
1186 * while making the connection with the server asynchronously at a later time.
1187 */
1188 set badCertificateCallback(bool callback(X509Certificate cert,
1189 String host,
1190 int port));
1191
1192 /**
1175 * Shutdown the HTTP client. If [force] is [:false:] (the default) 1193 * Shutdown the HTTP client. If [force] is [:false:] (the default)
1176 * the [:HttpClient:] will be kept alive until all active 1194 * the [:HttpClient:] will be kept alive until all active
1177 * connections are done. If [force] is [:true:] any active 1195 * connections are done. If [force] is [:true:] any active
1178 * connections will be closed to immediately release all 1196 * connections will be closed to immediately release all
1179 * resources. These closed connections will receive an [:onError:] 1197 * resources. These closed connections will receive an [:onError:]
1180 * callback to indicate that the client was shutdown. In both cases 1198 * callback to indicate that the client was shutdown. In both cases
1181 * trying to establish a new connection after calling [shutdown] 1199 * trying to establish a new connection after calling [shutdown]
1182 * will throw an exception. 1200 * will throw an exception.
1183 */ 1201 */
1184 void close({bool force: false}); 1202 void close({bool force: false});
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
1307 * Returns the status code. 1325 * Returns the status code.
1308 */ 1326 */
1309 int get statusCode; 1327 int get statusCode;
1310 1328
1311 /** 1329 /**
1312 * Returns the reason phrase associated with the status code. 1330 * Returns the reason phrase associated with the status code.
1313 */ 1331 */
1314 String get reasonPhrase; 1332 String get reasonPhrase;
1315 1333
1316 /** 1334 /**
1317 * Returns the content length of the request body. Returns -1 if the size of 1335 * Returns the content length of the response body. Returns -1 if the size of
1318 * the request body is not known in advance. 1336 * the response body is not known in advance.
1319 */ 1337 */
1320 int get contentLength; 1338 int get contentLength;
1321 1339
1322 /** 1340 /**
1323 * Gets the persistent connection state returned by the server. 1341 * Gets the persistent connection state returned by the server.
1324 */ 1342 */
1325 bool get persistentConnection; 1343 bool get persistentConnection;
1326 1344
1327 /** 1345 /**
1328 * Returns whether the status code is one of the normal redirect 1346 * Returns whether the status code is one of the normal redirect
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
1483 1501
1484 class RedirectException implements HttpException { 1502 class RedirectException implements HttpException {
1485 final String message; 1503 final String message;
1486 final List<RedirectInfo> redirects; 1504 final List<RedirectInfo> redirects;
1487 1505
1488 const RedirectException(String this.message, 1506 const RedirectException(String this.message,
1489 List<RedirectInfo> this.redirects); 1507 List<RedirectInfo> this.redirects);
1490 1508
1491 String toString() => "RedirectException: $message"; 1509 String toString() => "RedirectException: $message";
1492 } 1510 }
OLDNEW
« no previous file with comments | « no previous file | sdk/lib/io/http_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698