Chromium Code Reviews| Index: net/proxy/proxy_config.h |
| diff --git a/net/proxy/proxy_config.h b/net/proxy/proxy_config.h |
| index 29619dff1e36ae3cd4ac02e96365b660b2817ef4..faee16db8312be93fff36d34a027b3c1897cca0b 100644 |
| --- a/net/proxy/proxy_config.h |
| +++ b/net/proxy/proxy_config.h |
| @@ -11,6 +11,7 @@ |
| #include "net/base/net_export.h" |
| #include "net/proxy/proxy_bypass_rules.h" |
| #include "net/proxy/proxy_config_source.h" |
| +#include "net/proxy/proxy_list.h" |
| #include "net/proxy/proxy_server.h" |
| namespace base { |
| @@ -36,6 +37,8 @@ class NET_EXPORT ProxyConfig { |
| public: |
| // ProxyRules describes the "manual" proxy settings. |
| // TODO(eroman): Turn this into a class. |
| + // TODO(marq): Update the enum names; "TYPE_SINGLE_PROXY" really means |
| + // the same set of proxies are used for all requests. |
| struct NET_EXPORT ProxyRules { |
| enum Type { |
| TYPE_NO_RULES, |
| @@ -52,31 +55,54 @@ class NET_EXPORT ProxyConfig { |
| return type == TYPE_NO_RULES; |
| } |
| - // Sets |result| with the proxy to use for |url| based on the current rules. |
| + // Sets |result| with the proxies to use for |url| based on the current |
| + // rules. |
| void Apply(const GURL& url, ProxyInfo* result) const; |
| // Parses the rules from a string, indicating which proxies to use. |
| // |
| // proxy-uri = [<proxy-scheme>"://"]<proxy-host>[":"<proxy-port>] |
| // |
| - // If the proxy to use depends on the scheme of the URL, can instead specify |
| - // a semicolon separated list of: |
| + // proxy-uri-list = <proxy-uri>[","<proxy-uri-list>] |
| // |
| - // <url-scheme>"="<proxy-uri> |
| + // If all URLs should use the same proxies, |proxy_rules| should be a |
|
eroman
2013/03/05 01:55:55
[optional] Your current wording is fine. Another w
marq_use_my_chromium_address
2013/03/05 22:52:40
Done.
|
| + // <proxy-uri-list>. |
| + // |
| + // If the proxy to use depends on the scheme of the URL, |proxy_rules| can |
| + // instead be a a semicolon separated list of: |
| + // |
| + // <url-scheme>"="<proxy-uri-list> |
| + // |
| + // If 'socks' is specified as a scheme, any schemes left without proxies |
| + // specified will have that 'socks' server added. |
|
eroman
2013/03/05 01:55:55
This is best understood in terms of fallback-proxy
marq_use_my_chromium_address
2013/03/05 22:52:40
Done.
|
| // |
| // For example: |
| // "http=foopy:80;ftp=foopy2" -- use HTTP proxy "foopy:80" for http:// |
| // URLs, and HTTP proxy "foopy2:80" for |
| // ftp:// URLs. |
| // "foopy:80" -- use HTTP proxy "foopy:80" for all URLs. |
| + // "foopy:80,bar,direct://" -- use HTTP proxy "foopy:80" for all URLs, |
| + // failing over to "bar" if "foopy:80" is |
| + // unavailable, and after that using no |
| + // proxy. |
| // "socks4://foopy" -- use SOCKS v4 proxy "foopy:1080" for all |
| // URLs. |
| + // "http=foopy,bar.com -- use HTTP proxy "foopy" for http URLs, |
|
eroman
2013/03/05 01:55:55
To make this example more interesting, I suggest c
marq_use_my_chromium_address
2013/03/05 22:52:40
Done.
|
| + // and fail over to "bar.com" if "foopy" |
| + // is unavailable. |
| + // "http=foopy,direct:// -- use HTTP proxy "foopy" for http URLs, |
| + // and use no proxy if "foopy" is |
| + // unavailable. |
| + // "http=foopy;socks=foopy2 -- use HTTP proxy "foopy" for http URLs, |
| + // and use socks4://foopy2 for all other |
| + // URLs. |
| void ParseFromString(const std::string& proxy_rules); |
| - // Returns one of {&proxy_for_http, &proxy_for_https, &proxy_for_ftp, |
| - // &fallback_proxy}, or NULL if there is no proxy to use. |
| + // Returns one of {&proxies_for_http, &proxies_for_https, &proxies_for_ftp, |
| + // &fallback_proxies}, or NULL if there is no proxy to use. |
| // Should only call this if the type is TYPE_PROXY_PER_SCHEME. |
| - const ProxyServer* MapUrlSchemeToProxy(const std::string& url_scheme) const; |
| + const ProxyList* MapUrlSchemeToProxyList( |
| + const std::string& url_scheme) const; |
| // Returns true if |*this| describes the same configuration as |other|. |
| bool Equals(const ProxyRules& other) const; |
| @@ -90,21 +116,22 @@ class NET_EXPORT ProxyConfig { |
| Type type; |
| // Set if |type| is TYPE_SINGLE_PROXY. |
| - ProxyServer single_proxy; |
| + ProxyList single_proxies; |
| // Set if |type| is TYPE_PROXY_PER_SCHEME. |
| - ProxyServer proxy_for_http; |
| - ProxyServer proxy_for_https; |
| - ProxyServer proxy_for_ftp; |
| + ProxyList proxies_for_http; |
| + ProxyList proxies_for_https; |
| + ProxyList proxies_for_ftp; |
| - // Used when there isn't a more specific per-scheme proxy server. |
| - ProxyServer fallback_proxy; |
| + // Used when a fallback has been defined and the url to be proxied doesn't |
| + // match any of the standard schemes. |
| + ProxyList fallback_proxies; |
| private: |
| - // Returns one of {&proxy_for_http, &proxy_for_https, &proxy_for_ftp} |
| + // Returns one of {&proxies_for_http, &proxies_for_https, &proxies_for_ftp} |
| // or NULL if it is a scheme that we don't have a mapping |
| // for. Should only call this if the type is TYPE_PROXY_PER_SCHEME. |
| - ProxyServer* MapUrlSchemeToProxyNoFallback(const std::string& scheme); |
| + ProxyList* MapUrlSchemeToProxyListNoFallback(const std::string& scheme); |
| }; |
| typedef int ID; |