Index: net/proxy/proxy_config_service_linux.cc |
=================================================================== |
--- net/proxy/proxy_config_service_linux.cc (revision 15852) |
+++ net/proxy/proxy_config_service_linux.cc (working copy) |
@@ -114,71 +114,6 @@ |
result_server); |
} |
-namespace { |
- |
-// Returns true if the given string represents an IP address. |
-bool IsIPAddress(const std::string& domain) { |
- // From GURL::HostIsIPAddress() |
- url_canon::RawCanonOutputT<char, 128> ignored_output; |
- url_parse::Component ignored_component; |
- url_parse::Component domain_comp(0, domain.size()); |
- return url_canon::CanonicalizeIPAddress(domain.c_str(), domain_comp, |
- &ignored_output, |
- &ignored_component); |
-} |
- |
-} // namespace |
- |
-void ProxyConfigServiceLinux::ParseNoProxyList(const std::string& no_proxy, |
- ProxyConfig* config) { |
- if (no_proxy.empty()) |
- return; |
- // Traditional semantics: |
- // A single "*" is specifically allowed and unproxies anything. |
- // "*" wildcards other than a single "*" entry are not universally |
- // supported. We will support them, as we get * wildcards for free |
- // (see MatchPattern() called from ProxyService::ShouldBypassProxyForURL()). |
- // no_proxy is a comma-separated list of <trailing_domain>[:<port>]. |
- // If no port is specified then any port matches. |
- // The historical definition has trailing_domain match using a simple |
- // string "endswith" test, so that the match need not correspond to a |
- // "." boundary. For example: "google.com" matches "igoogle.com" too. |
- // Seems like that could be confusing, but we'll obey tradition. |
- // IP CIDR patterns are supposed to be supported too. We intend |
- // to do this in proxy_service.cc, but it's currently a TODO. |
- // See: http://crbug.com/9835. |
- StringTokenizer no_proxy_list(no_proxy, ","); |
- while (no_proxy_list.GetNext()) { |
- std::string bypass_entry = no_proxy_list.token(); |
- TrimWhitespaceASCII(bypass_entry, TRIM_ALL, &bypass_entry); |
- if (bypass_entry.empty()) |
- continue; |
- if (bypass_entry.at(0) != '*') { |
- // Insert a wildcard * to obtain an endsWith match, unless the |
- // entry looks like it might be an IP or CIDR. |
- // First look for either a :<port> or CIDR mask length suffix. |
- std::string::const_iterator begin = bypass_entry.begin(); |
- std::string::const_iterator scan = bypass_entry.end() - 1; |
- while (scan > begin && IsAsciiDigit(*scan)) |
- --scan; |
- std::string potential_ip; |
- if (*scan == '/' || *scan == ':') |
- potential_ip = std::string(begin, scan - 1); |
- else |
- potential_ip = bypass_entry; |
- if (!IsIPAddress(potential_ip)) { |
- // Do insert a wildcard. |
- bypass_entry.insert(0, "*"); |
- } |
- // TODO(sdoyon): When CIDR matching is implemented in |
- // proxy_service.cc, consider making config->proxy_bypass more |
- // sophisticated to avoid parsing out the string on every |
- // request. |
- } |
- config->proxy_bypass.push_back(bypass_entry); |
- } |
-} |
- |
bool ProxyConfigServiceLinux::GetConfigFromEnv(ProxyConfig* config) { |
// Check for automatic configuration first, in |
// "auto_proxy". Possibly only the "environment_proxy" firefox |
@@ -242,7 +177,7 @@ |
// connections. |
return !no_proxy.empty(); |
} |
- ParseNoProxyList(no_proxy, config); |
+ config->ParseNoProxyList(no_proxy); |
return true; |
} |