summaryrefslogtreecommitdiffstats
path: root/net/proxy/proxy_service.cc
diff options
context:
space:
mode:
authoravi@google.com <avi@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-10-31 17:15:56 +0000
committeravi@google.com <avi@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-10-31 17:15:56 +0000
commit153d44b69e23ac6e1ca2efa64ef5544f08cb8c71 (patch)
treed998fd23a0dc7de5148c2b53b2a2769d4e4bddbc /net/proxy/proxy_service.cc
parent55209a4b0b801a3bc2f790d4a75d10ccfdf34f6e (diff)
downloadchromium_src-153d44b69e23ac6e1ca2efa64ef5544f08cb8c71.zip
chromium_src-153d44b69e23ac6e1ca2efa64ef5544f08cb8c71.tar.gz
chromium_src-153d44b69e23ac6e1ca2efa64ef5544f08cb8c71.tar.bz2
Relanding of r4221, initial proxy support for the Mac
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@4293 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/proxy/proxy_service.cc')
-rw-r--r--net/proxy/proxy_service.cc29
1 files changed, 19 insertions, 10 deletions
diff --git a/net/proxy/proxy_service.cc b/net/proxy/proxy_service.cc
index 52d8491..394a97f 100644
--- a/net/proxy/proxy_service.cc
+++ b/net/proxy/proxy_service.cc
@@ -30,6 +30,7 @@ ProxyConfig::ID ProxyConfig::last_id_ = ProxyConfig::INVALID_ID;
ProxyConfig::ProxyConfig()
: auto_detect(false),
+ proxy_bypass_local_names(false),
id_(++last_id_) {
}
@@ -39,7 +40,8 @@ bool ProxyConfig::Equals(const ProxyConfig& other) const {
return auto_detect == other.auto_detect &&
pac_url == other.pac_url &&
proxy_server == other.proxy_server &&
- proxy_bypass == other.proxy_bypass;
+ proxy_bypass == other.proxy_bypass &&
+ proxy_bypass_local_names == other.proxy_bypass_local_names;
}
// ProxyList ------------------------------------------------------------------
@@ -445,17 +447,18 @@ bool ProxyService::ShouldBypassProxyForURL(const GURL& url) {
url_domain += "://";
url_domain += url.host();
+ // This isn't superfluous; GURL case canonicalization doesn't hit the embedded
+ // percent-encoded characters.
StringToLowerASCII(&url_domain);
- StringTokenizer proxy_server_bypass_list(config_.proxy_bypass, ";");
- while (proxy_server_bypass_list.GetNext()) {
- std::string bypass_url_domain = proxy_server_bypass_list.token();
- if (bypass_url_domain == "<local>") {
- // Any name without a DOT (.) is considered to be local.
- if (url.host().find('.') == std::string::npos)
- return true;
- continue;
- }
+ if (config_.proxy_bypass_local_names) {
+ if (url.host().find('.') == std::string::npos)
+ return true;
+ }
+
+ for(std::vector<std::string>::const_iterator i = config_.proxy_bypass.begin();
+ i != config_.proxy_bypass.end(); ++i) {
+ std::string bypass_url_domain = *i;
// The proxy server bypass list can contain entities with http/https
// If no scheme is specified then it indicates that all schemes are
@@ -473,6 +476,12 @@ bool ProxyService::ShouldBypassProxyForURL(const GURL& url) {
if (MatchPattern(url_domain, bypass_url_domain))
return true;
+
+ // Some systems (the Mac, for example) allow CIDR-style specification of
+ // proxy bypass for IP-specified hosts (e.g. "10.0.0.0/8"; see
+ // http://www.tcd.ie/iss/internet/osx_proxy.php for a real-world example).
+ // That's kinda cool so we'll provide that for everyone.
+ // TODO(avi): implement here
}
return false;