Chromium Code Reviews| 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 925 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 936 * `Dart/<version> (dart:io)`. | 936 * `Dart/<version> (dart:io)`. |
| 937 * | 937 * |
| 938 * If the userAgent is set to `null`, no default `User-Agent` header will be | 938 * If the userAgent is set to `null`, no default `User-Agent` header will be |
| 939 * added to each request. | 939 * added to each request. |
| 940 */ | 940 */ |
| 941 String userAgent; | 941 String userAgent; |
| 942 | 942 |
| 943 factory HttpClient() => new _HttpClient(); | 943 factory HttpClient() => new _HttpClient(); |
| 944 | 944 |
| 945 /** | 945 /** |
| 946 * Opens a HTTP connection. The returned [HttpClientRequest] is used to | 946 * Opens a HTTP connection. |
| 947 * fill in the content of the request before sending it. The 'host' header for | 947 * |
| 948 * the request will be set to the value [host]:[port]. This can be overridden | 948 * The HTTP method to use is specified in [method], the server is |
| 949 * through the [HttpClientRequest] interface before the request is sent. | 949 * specified using [host] and [port], and the path is specified |
| 950 * NOTE if [host] is an IP address this will still be set in the 'host' | 950 * using [path]. |
| 951 * | |
| 952 * The `Host` header for the request will be set to the value | |
| 953 * [host]:[port]. This can be overridden through the | |
| 954 * [HttpClientRequest] interface before the request is sent. NOTE | |
| 955 * if [host] is an IP address this will still be set in the `Host` | |
| 951 * header. | 956 * header. |
| 957 * | |
| 958 * For additional information on when the returned future completes, | |
| 959 * and the flow of the HTTP request, see the overall documentation | |
|
Bill Hesse
2013/08/01 08:33:31
Would
completes, and on using the HttpClientReque
Søren Gjesse
2013/08/01 09:25:59
Yes, thanks (picked the second one).
| |
| 960 * for the class [HttpClient]. | |
| 952 */ | 961 */ |
| 953 Future<HttpClientRequest> open(String method, | 962 Future<HttpClientRequest> open(String method, |
| 954 String host, | 963 String host, |
| 955 int port, | 964 int port, |
| 956 String path); | 965 String path); |
| 957 | 966 |
| 958 /** | 967 /** |
| 959 * Opens a HTTP connection. The returned [HttpClientRequest] is used to | 968 * Opens a HTTP connection. |
| 960 * fill in the content of the request before sending it. The 'hosth header for | 969 * |
| 961 * the request will be set to the value [host]:[port]. This can be overridden | 970 * Tht HTTP method is specified in [method] and the URL to use in |
| 962 * through the [HttpClientRequest] interface before the request is sent. | 971 * [url]. |
| 963 * NOTE if [host] is an IP address this will still be set in the 'host' | 972 * |
| 973 * The `Host` header for the request will be set to the value | |
| 974 * [host]:[port]. This can be overridden through the | |
| 975 * [HttpClientRequest] interface before the request is sent. NOTE | |
| 976 * if [host] is an IP address this will still be set in the `Host` | |
| 964 * header. | 977 * header. |
| 978 * | |
| 979 * For additional information on when the returned future completes, | |
| 980 * and the flow of the HTTP request, see the overall documentation | |
| 981 * for the class [HttpClient]. | |
| 965 */ | 982 */ |
| 966 Future<HttpClientRequest> openUrl(String method, Uri url); | 983 Future<HttpClientRequest> openUrl(String method, Uri url); |
| 967 | 984 |
| 968 /** | 985 /** |
| 969 * Opens a HTTP connection using the GET method. See [open] for | 986 * Opens a HTTP connection using the GET method. |
| 970 * details. Using this method to open a HTTP connection will set the | 987 * |
| 971 * content length to 0. | 988 * The server is specified using [host] and [port], and the path is |
| 989 * specified using [path]. | |
|
Bill Hesse
2013/08/01 08:33:31
path (and possible query)
?
Søren Gjesse
2013/08/01 09:25:59
Done, added fragment as well.
| |
| 990 * | |
| 991 * See [open] for details. | |
| 972 */ | 992 */ |
| 973 Future<HttpClientRequest> get(String host, int port, String path); | 993 Future<HttpClientRequest> get(String host, int port, String path); |
| 974 | 994 |
| 975 /** | 995 /** |
| 976 * Opens a HTTP connection using the GET method. See [openUrl] for | 996 * Opens a HTTP connection using the GET method. |
| 977 * details. Using this method to open a HTTP connection will set the | 997 * |
| 978 * content length to 0. | 998 * The URL to use is specified in [url]. |
| 999 * | |
| 1000 * See [openUrl] for details. | |
| 979 */ | 1001 */ |
| 980 Future<HttpClientRequest> getUrl(Uri url); | 1002 Future<HttpClientRequest> getUrl(Uri url); |
| 981 | 1003 |
| 982 /** | 1004 /** |
| 983 * Opens a HTTP connection using the POST method. See [open] for details. | 1005 * Opens a HTTP connection using the POST method. |
| 1006 * | |
| 1007 * The server is specified using [host] and [port], and the path is | |
| 1008 * specified using [path]. | |
| 1009 * | |
| 1010 * See [open] for details. | |
| 984 */ | 1011 */ |
| 985 Future<HttpClientRequest> post(String host, int port, String path); | 1012 Future<HttpClientRequest> post(String host, int port, String path); |
| 986 | 1013 |
| 987 /** | 1014 /** |
| 988 * Opens a HTTP connection using the POST method. See [openUrl] for details. | 1015 * Opens a HTTP connection using the POST method. |
| 1016 * | |
| 1017 * The URL to use is specified in [url]. | |
| 1018 * | |
| 1019 * See [openUrl] for details. | |
| 989 */ | 1020 */ |
| 990 Future<HttpClientRequest> postUrl(Uri url); | 1021 Future<HttpClientRequest> postUrl(Uri url); |
| 991 | 1022 |
| 992 /** | 1023 /** |
| 993 * Sets the function to be called when a site is requesting | 1024 * Sets the function to be called when a site is requesting |
| 994 * authentication. The URL requested and the security realm from the | 1025 * authentication. The URL requested and the security realm from the |
| 995 * server are passed in the arguments [url] and [realm]. | 1026 * server are passed in the arguments [url] and [realm]. |
| 996 * | 1027 * |
| 997 * The function returns a [Future] which should complete when the | 1028 * The function returns a [Future] which should complete when the |
| 998 * authentication has been resolved. If credentials cannot be | 1029 * authentication has been resolved. If credentials cannot be |
| (...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1435 | 1466 |
| 1436 class RedirectException implements HttpException { | 1467 class RedirectException implements HttpException { |
| 1437 final String message; | 1468 final String message; |
| 1438 final List<RedirectInfo> redirects; | 1469 final List<RedirectInfo> redirects; |
| 1439 | 1470 |
| 1440 const RedirectException(String this.message, | 1471 const RedirectException(String this.message, |
| 1441 List<RedirectInfo> this.redirects); | 1472 List<RedirectInfo> this.redirects); |
| 1442 | 1473 |
| 1443 String toString() => "RedirectException: $message"; | 1474 String toString() => "RedirectException: $message"; |
| 1444 } | 1475 } |
| OLD | NEW |