Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(410)

Unified Diff: sdk/lib/io/http.dart

Issue 12866005: Add a function for finding the HTTP proxy server from environment variables (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | sdk/lib/io/http_impl.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/io/http.dart
diff --git a/sdk/lib/io/http.dart b/sdk/lib/io/http.dart
index 912a366d737af66da4a3bdca182ba71b277fcba2..9a54af20c27d0421de5a5aebcb119a3653b36218 100644
--- a/sdk/lib/io/http.dart
+++ b/sdk/lib/io/http.dart
@@ -866,10 +866,64 @@ abstract class HttpClient {
* separated by semicolons, e.g.
*
* "PROXY host:port; PROXY host2:port2; DIRECT"
+ *
+ * The static function [findProxyFromEnvironment] on this class can
+ * be used to implement proxy server resolving based on environment
+ * variables.
*/
set findProxy(String f(Uri url));
/**
+ * Function for resolving the proxy server to be used for a HTTP
+ * connection from the proxy configuration specified through
+ * environment variables.
+ *
+ * The following environment variables are taken into account:
+ *
+ * * 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
+ * default of 1080 will be used. If both are set the lower case one takes
+ * precedence.
+ *
+ * [:https_proxy:] and [:HTTPS_PROXY:] specify the proxy server to use for
+ * https:// urls. Use the format [:hostname:port:]. If no port is used a
+ * default of 1080 will be used. If both are set the lower case one takes
+ * precedence.
+ *
+ * [:no_proxy:] and [:NO_PROXY:] specify a comma separated list of
+ * postfixes of hostnames for which not to use the proxy
+ * server. E.g. the value "localhost,127.0.0.1" will make requests
+ * to both "localhost" and "127.0.0.1" not use a proxy. If both are set
+ * the lower case one takes precedence.
+ *
+ * To activate this way of resolving proxies assign this function to
+ * the [findProxy] property on the [HttpClient].
+ *
+ * HttpClient client = new HttpClient();
+ * client.findProxy = HttpClient.findProxyFromEnvironment;
+ *
+ * If you don't want to use the system environment you can use a
+ * different one by wrapping the function.
+ *
+ * HttpClient client = new HttpClient();
+ * client.findProxy = (url) {
+ * return HttpClient.findProxyFromEnvironment(
+ * url, {"http_proxy": ..., "no_proxy": ...});
+ * }
+ */
+ static String findProxyFromEnvironment(Uri url,
+ {Map<String, String> environment}) {
+ return _HttpClient._findProxyFromEnvironment(url, environment);
+ }
+
+ /**
* 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
« no previous file with comments | « no previous file | sdk/lib/io/http_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698