| 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 * Likewise, when writing to a [HttpResponse], any [Socket] exceptions are | 68 * Likewise, when writing to a [HttpResponse], any [Socket] exceptions are |
| 69 * ignored and any future writes are ignored. | 69 * ignored and any future writes are ignored. |
| 70 * | 70 * |
| 71 * The [HttpRequest] exposes the request headers, and provides the request body, | 71 * The [HttpRequest] exposes the request headers, and provides the request body, |
| 72 * if it exists, as a stream of data. If the body is unread, it'll be drained | 72 * if it exists, as a stream of data. If the body is unread, it'll be drained |
| 73 * when the [HttpResponse] is being written to or closed. | 73 * when the [HttpResponse] is being written to or closed. |
| 74 * | 74 * |
| 75 * The following example shows how to bind a [HttpServer] to a IPv6 | 75 * The following example shows how to bind a [HttpServer] to a IPv6 |
| 76 * [InternetAddress] on port 80, and listening to requests. | 76 * [InternetAddress] on port 80, and listening to requests. |
| 77 * | 77 * |
| 78 * HttpServer.bind(InternetAddress.ANY_IP_V6, 80).then((server) { | 78 * HttpServer.bind(InternetAddress.ANY_IP_V6, 80).then((server) { |
| 79 * server.listen((HttpRequest request) { | 79 * server.listen((HttpRequest request) { |
| 80 * // Handle requests. | 80 * // Handle requests. |
| 81 * }); |
| 81 * }); | 82 * }); |
| 82 * }); | |
| 83 */ | 83 */ |
| 84 abstract class HttpServer implements Stream<HttpRequest> { | 84 abstract class HttpServer implements Stream<HttpRequest> { |
| 85 /** | 85 /** |
| 86 * Starts listening for HTTP requests on the specified [address] and | 86 * Starts listening for HTTP requests on the specified [address] and |
| 87 * [port]. | 87 * [port]. |
| 88 * | 88 * |
| 89 * The [address] can either be a [String] or an | 89 * The [address] can either be a [String] or an |
| 90 * [InternetAddress]. If [address] is a [String], [bind] will | 90 * [InternetAddress]. If [address] is a [String], [bind] will |
| 91 * perform a [InternetAddress.lookup] and use the first value in the | 91 * perform a [InternetAddress.lookup] and use the first value in the |
| 92 * list. To listen on the loopback adapter, which will allow only | 92 * list. To listen on the loopback adapter, which will allow only |
| (...skipping 1056 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1149 void addCredentials(Uri url, String realm, HttpClientCredentials credentials); | 1149 void addCredentials(Uri url, String realm, HttpClientCredentials credentials); |
| 1150 | 1150 |
| 1151 /** | 1151 /** |
| 1152 * Sets the function used to resolve the proxy server to be used for | 1152 * Sets the function used to resolve the proxy server to be used for |
| 1153 * opening a HTTP connection to the specified [url]. If this | 1153 * opening a HTTP connection to the specified [url]. If this |
| 1154 * function is not set, direct connections will always be used. | 1154 * function is not set, direct connections will always be used. |
| 1155 * | 1155 * |
| 1156 * The string returned by [f] must be in the format used by browser | 1156 * The string returned by [f] must be in the format used by browser |
| 1157 * PAC (proxy auto-config) scripts. That is either | 1157 * PAC (proxy auto-config) scripts. That is either |
| 1158 * | 1158 * |
| 1159 * "DIRECT" | 1159 * "DIRECT" |
| 1160 * | 1160 * |
| 1161 * for using a direct connection or | 1161 * for using a direct connection or |
| 1162 * | 1162 * |
| 1163 * "PROXY host:port" | 1163 * "PROXY host:port" |
| 1164 * | 1164 * |
| 1165 * for using the proxy server [:host:] on port [:port:]. | 1165 * for using the proxy server [:host:] on port [:port:]. |
| 1166 * | 1166 * |
| 1167 * A configuration can contain several configuration elements | 1167 * A configuration can contain several configuration elements |
| 1168 * separated by semicolons, e.g. | 1168 * separated by semicolons, e.g. |
| 1169 * | 1169 * |
| 1170 * "PROXY host:port; PROXY host2:port2; DIRECT" | 1170 * "PROXY host:port; PROXY host2:port2; DIRECT" |
| 1171 * | 1171 * |
| 1172 * The static function [findProxyFromEnvironment] on this class can | 1172 * The static function [findProxyFromEnvironment] on this class can |
| 1173 * be used to implement proxy server resolving based on environment | 1173 * be used to implement proxy server resolving based on environment |
| 1174 * variables. | 1174 * variables. |
| 1175 */ | 1175 */ |
| 1176 set findProxy(String f(Uri url)); | 1176 set findProxy(String f(Uri url)); |
| 1177 | 1177 |
| 1178 /** | 1178 /** |
| 1179 * Function for resolving the proxy server to be used for a HTTP | 1179 * Function for resolving the proxy server to be used for a HTTP |
| 1180 * connection from the proxy configuration specified through | 1180 * connection from the proxy configuration specified through |
| (...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1599 final String message; | 1599 final String message; |
| 1600 final List<RedirectInfo> redirects; | 1600 final List<RedirectInfo> redirects; |
| 1601 | 1601 |
| 1602 const RedirectException(String this.message, | 1602 const RedirectException(String this.message, |
| 1603 List<RedirectInfo> this.redirects); | 1603 List<RedirectInfo> this.redirects); |
| 1604 | 1604 |
| 1605 String toString() => "RedirectException: $message"; | 1605 String toString() => "RedirectException: $message"; |
| 1606 | 1606 |
| 1607 Uri get uri => redirects.last.location; | 1607 Uri get uri => redirects.last.location; |
| 1608 } | 1608 } |
| OLD | NEW |