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 848 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
859 * for using a direct connection or | 859 * for using a direct connection or |
860 * | 860 * |
861 * "PROXY host:port" | 861 * "PROXY host:port" |
862 * | 862 * |
863 * for using the proxy server [:host:] on port [:port:]. | 863 * for using the proxy server [:host:] on port [:port:]. |
864 * | 864 * |
865 * A configuration can contain several configuration elements | 865 * A configuration can contain several configuration elements |
866 * separated by semicolons, e.g. | 866 * separated by semicolons, e.g. |
867 * | 867 * |
868 * "PROXY host:port; PROXY host2:port2; DIRECT" | 868 * "PROXY host:port; PROXY host2:port2; DIRECT" |
| 869 * |
| 870 * The static function [findProxyFromEnvironment] on this class can |
| 871 * be used to implement proxy server resolving based on environment |
| 872 * variables. |
869 */ | 873 */ |
870 set findProxy(String f(Uri url)); | 874 set findProxy(String f(Uri url)); |
871 | 875 |
872 /** | 876 /** |
| 877 * Function for resolving the proxy server to be used for a HTTP |
| 878 * connection from the proxy configuration specified through |
| 879 * environment variables. |
| 880 * |
| 881 * The following environment variables are taken into account: |
| 882 * |
| 883 * * http_proxy |
| 884 * * https_proxy |
| 885 * * no_proxy |
| 886 * * HTTP_PROXY |
| 887 * * HTTPS_PROXY |
| 888 * * NO_PROXY |
| 889 * |
| 890 * [:http_proxy:] and [:HTTP_PROXY:] specify the proxy server to use for |
| 891 * http:// urls. Use the format [:hostname:port:]. If no port is used a |
| 892 * default of 1080 will be used. If both are set the lower case one takes |
| 893 * precedence. |
| 894 * |
| 895 * [:https_proxy:] and [:HTTPS_PROXY:] specify the proxy server to use for |
| 896 * https:// urls. Use the format [:hostname:port:]. If no port is used a |
| 897 * default of 1080 will be used. If both are set the lower case one takes |
| 898 * precedence. |
| 899 * |
| 900 * [:no_proxy:] and [:NO_PROXY:] specify a comma separated list of |
| 901 * postfixes of hostnames for which not to use the proxy |
| 902 * server. E.g. the value "localhost,127.0.0.1" will make requests |
| 903 * to both "localhost" and "127.0.0.1" not use a proxy. If both are set |
| 904 * the lower case one takes precedence. |
| 905 * |
| 906 * To activate this way of resolving proxies assign this function to |
| 907 * the [findProxy] property on the [HttpClient]. |
| 908 * |
| 909 * HttpClient client = new HttpClient(); |
| 910 * client.findProxy = HttpClient.findProxyFromEnvironment; |
| 911 * |
| 912 * If you don't want to use the system environment you can use a |
| 913 * different one by wrapping the function. |
| 914 * |
| 915 * HttpClient client = new HttpClient(); |
| 916 * client.findProxy = (url) { |
| 917 * return HttpClient.findProxyFromEnvironment( |
| 918 * url, {"http_proxy": ..., "no_proxy": ...}); |
| 919 * } |
| 920 */ |
| 921 static String findProxyFromEnvironment(Uri url, |
| 922 {Map<String, String> environment}) { |
| 923 return _HttpClient._findProxyFromEnvironment(url, environment); |
| 924 } |
| 925 |
| 926 /** |
873 * Shutdown the HTTP client. If [force] is [:false:] (the default) | 927 * Shutdown the HTTP client. If [force] is [:false:] (the default) |
874 * the [:HttpClient:] will be kept alive until all active | 928 * the [:HttpClient:] will be kept alive until all active |
875 * connections are done. If [force] is [:true:] any active | 929 * connections are done. If [force] is [:true:] any active |
876 * connections will be closed to immediately release all | 930 * connections will be closed to immediately release all |
877 * resources. These closed connections will receive an [:onError:] | 931 * resources. These closed connections will receive an [:onError:] |
878 * callback to indicate that the client was shutdown. In both cases | 932 * callback to indicate that the client was shutdown. In both cases |
879 * trying to establish a new connection after calling [shutdown] | 933 * trying to establish a new connection after calling [shutdown] |
880 * will throw an exception. | 934 * will throw an exception. |
881 */ | 935 */ |
882 void close({bool force: false}); | 936 void close({bool force: false}); |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1165 class RedirectLimitExceededException extends RedirectException { | 1219 class RedirectLimitExceededException extends RedirectException { |
1166 const RedirectLimitExceededException(List<RedirectInfo> redirects) | 1220 const RedirectLimitExceededException(List<RedirectInfo> redirects) |
1167 : super("Redirect limit exceeded", redirects); | 1221 : super("Redirect limit exceeded", redirects); |
1168 } | 1222 } |
1169 | 1223 |
1170 | 1224 |
1171 class RedirectLoopException extends RedirectException { | 1225 class RedirectLoopException extends RedirectException { |
1172 const RedirectLoopException(List<RedirectInfo> redirects) | 1226 const RedirectLoopException(List<RedirectInfo> redirects) |
1173 : super("Redirect loop detected", redirects); | 1227 : super("Redirect loop detected", redirects); |
1174 } | 1228 } |
OLD | NEW |