| Index: net/proxy/proxy_config.h
|
| diff --git a/net/proxy/proxy_config.h b/net/proxy/proxy_config.h
|
| index 29619dff1e36ae3cd4ac02e96365b660b2817ef4..289aaee935f34d319d1ed5b8b194bf0c63a64977 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,63 @@ 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>
|
| + // url-scheme = "http" | "https" | "ftp" | "socks"
|
| + //
|
| + // scheme-proxies = [<url-scheme>"="]<proxy-uri-list>
|
| + //
|
| + // proxy-rules = scheme-proxies[";"<scheme-proxies>]
|
| + //
|
| + // Thus, the proxy-rules string should be a semicolon-separated list of
|
| + // ordered proxies that apply to a particular URL scheme. Unless specified,
|
| + // the proxy scheme for proxy-uris is assumed to be http.
|
| + //
|
| + // Some special cases:
|
| + // * If the scheme is omitted from the first proxy list, that list applies
|
| + // to all URL schemes and subsequent lists are ignored.
|
| + // * If a scheme is omitted from any proxy list after a list where a scheme
|
| + // has been provided, the list without a scheme is ignored.
|
| + // * If the url-scheme is set to 'socks', that sets a fallback list that
|
| + // to all otherwise unspecified url-schemes, however the default proxy-
|
| + // scheme for proxy urls in the 'socks' list is understood to be
|
| + // socks4:// if unspecified.
|
| //
|
| // 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=foop,socks5://bar.com -- use HTTP proxy "foopy" for http URLs,
|
| + // and fail over to the SOCKS5 proxy
|
| + // "bar.com" if "foop" 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 +125,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;
|
|
|