| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 * Sets 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 * When an secure HTTP request if made, using this HttpClient, and the |
| 1180 * server returns a server certificate that cannot be authenticated, the |
| 1181 * callback is called asynchronously with the [X509Certificate] object and |
| 1182 * the server's hostname and port. If the value of [badCertificateCallback] |
| 1183 * is [null], the bad certificate is rejected, as if the callback |
| 1184 * returned [false] |
| 1185 * |
| 1186 * If the callback returns true, the secure connection is accepted and the |
| 1187 * [:Future<HttpClientRequest>:] that was returned from the call making the |
| 1188 * request completes with a valid HttpRequest object. If the callback returns |
| 1189 * false, the [:Future<HttpClientRequest>:] completes with an exception. |
| 1190 * |
| 1191 * If a bad certificate is received on a connection attempt, the library calls |
| 1192 * the function that was the value of badCertificateCallback at the time |
| 1193 * the the request is made, even if the value of badCertificateCallback |
| 1194 * has changed since then. |
| 1195 */ |
| 1196 set badCertificateCallback(bool callback(X509Certificate cert, |
| 1197 String host, |
| 1198 int port)); |
| 1199 |
| 1200 /** |
| 1175 * Shutdown the HTTP client. If [force] is [:false:] (the default) | 1201 * Shutdown the HTTP client. If [force] is [:false:] (the default) |
| 1176 * the [:HttpClient:] will be kept alive until all active | 1202 * the [:HttpClient:] will be kept alive until all active |
| 1177 * connections are done. If [force] is [:true:] any active | 1203 * connections are done. If [force] is [:true:] any active |
| 1178 * connections will be closed to immediately release all | 1204 * connections will be closed to immediately release all |
| 1179 * resources. These closed connections will receive an [:onError:] | 1205 * resources. These closed connections will receive an [:onError:] |
| 1180 * callback to indicate that the client was shutdown. In both cases | 1206 * callback to indicate that the client was shutdown. In both cases |
| 1181 * trying to establish a new connection after calling [shutdown] | 1207 * trying to establish a new connection after calling [shutdown] |
| 1182 * will throw an exception. | 1208 * will throw an exception. |
| 1183 */ | 1209 */ |
| 1184 void close({bool force: false}); | 1210 void close({bool force: false}); |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1307 * Returns the status code. | 1333 * Returns the status code. |
| 1308 */ | 1334 */ |
| 1309 int get statusCode; | 1335 int get statusCode; |
| 1310 | 1336 |
| 1311 /** | 1337 /** |
| 1312 * Returns the reason phrase associated with the status code. | 1338 * Returns the reason phrase associated with the status code. |
| 1313 */ | 1339 */ |
| 1314 String get reasonPhrase; | 1340 String get reasonPhrase; |
| 1315 | 1341 |
| 1316 /** | 1342 /** |
| 1317 * Returns the content length of the request body. Returns -1 if the size of | 1343 * Returns the content length of the response body. Returns -1 if the size of |
| 1318 * the request body is not known in advance. | 1344 * the response body is not known in advance. |
| 1319 */ | 1345 */ |
| 1320 int get contentLength; | 1346 int get contentLength; |
| 1321 | 1347 |
| 1322 /** | 1348 /** |
| 1323 * Gets the persistent connection state returned by the server. | 1349 * Gets the persistent connection state returned by the server. |
| 1324 */ | 1350 */ |
| 1325 bool get persistentConnection; | 1351 bool get persistentConnection; |
| 1326 | 1352 |
| 1327 /** | 1353 /** |
| 1328 * Returns whether the status code is one of the normal redirect | 1354 * Returns whether the status code is one of the normal redirect |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1485 final String message; | 1511 final String message; |
| 1486 final List<RedirectInfo> redirects; | 1512 final List<RedirectInfo> redirects; |
| 1487 | 1513 |
| 1488 const RedirectException(String this.message, | 1514 const RedirectException(String this.message, |
| 1489 List<RedirectInfo> this.redirects); | 1515 List<RedirectInfo> this.redirects); |
| 1490 | 1516 |
| 1491 String toString() => "RedirectException: $message"; | 1517 String toString() => "RedirectException: $message"; |
| 1492 | 1518 |
| 1493 Uri get uri => redirects.last.location; | 1519 Uri get uri => redirects.last.location; |
| 1494 } | 1520 } |
| OLD | NEW |