Chromium Code Reviews| Index: sdk/lib/io/http.dart |
| diff --git a/sdk/lib/io/http.dart b/sdk/lib/io/http.dart |
| index 72fd67c5b4ee5ed191d0b11d70af7747ecf2b304..5ec79e248ad3934456395a7df6b9e5c0419b8782 100644 |
| --- a/sdk/lib/io/http.dart |
| +++ b/sdk/lib/io/http.dart |
| @@ -926,12 +926,12 @@ abstract class HttpClient { |
| * |
| * The following environment variables are taken into account: |
| * |
| - * * http_proxy |
| - * * https_proxy |
| - * * no_proxy |
| - * * HTTP_PROXY |
| - * * HTTPS_PROXY |
| - * * NO_PROXY |
| + * http_proxy |
| + * https_proxy |
| + * no_proxy |
| + * HTTP_PROXY |
| + * HTTPS_PROXY |
| + * NO_PROXY |
| * |
| * [:http_proxy:] and [:HTTP_PROXY:] specify the proxy server to use for |
| * http:// urls. Use the format [:hostname:port:]. If no port is used a |
| @@ -963,6 +963,12 @@ abstract class HttpClient { |
| * return HttpClient.findProxyFromEnvironment( |
| * url, {"http_proxy": ..., "no_proxy": ...}); |
| * } |
| + * |
| + * If a proxy requires authentication it is possible to configure |
| + * the username and password as well. Use the format |
| + * [:username:password@hostname:port:] to include the username and |
| + * password. Alternatively the API [addProxyCredentials] can be used |
| + * to set credentials for proxies which require authentication. |
| */ |
| static String findProxyFromEnvironment(Uri url, |
| {Map<String, String> environment}) { |
| @@ -970,6 +976,34 @@ abstract class HttpClient { |
| } |
| /** |
| + * Sets the function to be called when a proxy is requesting |
| + * authentication. The proxy used and and the security realm from |
|
Anders Johnsen
2013/04/15 07:07:19
double 'and'. Rewrite first part of the sentence.
Søren Gjesse
2013/04/15 07:42:00
Done.
|
| + * the server are passed in the arguments [host], [port] and |
| + * [realm]. |
| + * |
| + * The function returns a [Future] which should complete when the |
| + * authentication has been resolved. If credentials cannot be |
| + * provided the [Future] should complete with [false]. If |
| + * credentials are available the function should add these using |
| + * [addProxyCredentials] before completing the [Future] with the value |
| + * [true]. |
| + * |
| + * If the [Future] completes with [true] the request will be retried |
| + * using the updated credentials. Otherwise response processing will |
| + * continue normally. |
| + */ |
| + set authenticateProxy( |
| + Future<bool> f(String host, int port, String scheme, String realm)); |
| + |
| + /** |
| + * Add credentials to be used for authorizing HTTP proxies. |
| + */ |
| + void addProxyCredentials(String host, |
| + int port, |
| + String realm, |
| + HttpClientCredentials credentials); |
| + |
| + /** |
| * Shutdown the HTTP client. If [force] is [:false:] (the default) |
| * the [:HttpClient:] will be kept alive until all active |
| * connections are done. If [force] is [:true:] any active |