diff options
author | eroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-19 20:24:06 +0000 |
---|---|---|
committer | eroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-19 20:24:06 +0000 |
commit | 7541206c7a5160f3489d563b97f1c841c853dc22 (patch) | |
tree | b69621265589060c0577559c23c86db4de667191 /chrome/browser/net | |
parent | d68a04da3be6a4a5db3768f53b2b48735a6ec210 (diff) | |
download | chromium_src-7541206c7a5160f3489d563b97f1c841c853dc22.zip chromium_src-7541206c7a5160f3489d563b97f1c841c853dc22.tar.gz chromium_src-7541206c7a5160f3489d563b97f1c841c853dc22.tar.bz2 |
Split out the handling of proxy bypass rules into ProxyBypassRules. There are some pretty complicated rules, and this helps isolate that code and better test it.
This also lays a framework for addressing bug 9835 (IP/CIDR matching)
Lastly, adds support for the exclusion format ".domain" on all platforms, which is interpreted as "*.domain".
BUG=28112
TEST=ProxyBypassRulesTest.*
Review URL: http://codereview.chromium.org/601070
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@39486 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/net')
-rw-r--r-- | chrome/browser/net/chrome_url_request_context.cc | 2 | ||||
-rw-r--r-- | chrome/browser/net/chrome_url_request_context_unittest.cc | 18 |
2 files changed, 6 insertions, 14 deletions
diff --git a/chrome/browser/net/chrome_url_request_context.cc b/chrome/browser/net/chrome_url_request_context.cc index 79a94cd..bb8cba9 100644 --- a/chrome/browser/net/chrome_url_request_context.cc +++ b/chrome/browser/net/chrome_url_request_context.cc @@ -948,7 +948,7 @@ net::ProxyConfig* CreateProxyConfig(const CommandLine& command_line) { } if (command_line.HasSwitch(switches::kProxyBypassList)) { - proxy_config->ParseNoProxyList( + proxy_config->bypass_rules.ParseFromString( WideToASCII(command_line.GetSwitchValue( switches::kProxyBypassList))); } diff --git a/chrome/browser/net/chrome_url_request_context_unittest.cc b/chrome/browser/net/chrome_url_request_context_unittest.cc index e1ac43e..e7d679c 100644 --- a/chrome/browser/net/chrome_url_request_context_unittest.cc +++ b/chrome/browser/net/chrome_url_request_context_unittest.cc @@ -59,7 +59,6 @@ TEST(ChromeUrlRequestContextTest, CreateProxyConfigTest) { GURL pac_url; net::ProxyConfig::ProxyRules proxy_rules; const char* proxy_bypass_list; // newline separated - bool bypass_local_names; } tests[] = { { TEST_DESC("Empty command line"), @@ -71,7 +70,6 @@ TEST(ChromeUrlRequestContextTest, CreateProxyConfigTest) { GURL(), // pac_url net::ProxyConfig::ProxyRules(), // proxy_rules "", // proxy_bypass_list - false // bypass_local_names }, { TEST_DESC("No proxy"), @@ -83,7 +81,6 @@ TEST(ChromeUrlRequestContextTest, CreateProxyConfigTest) { GURL(), // pac_url net::ProxyConfig::ProxyRules(), // proxy_rules "", // proxy_bypass_list - false // bypass_local_names }, { TEST_DESC("No proxy with extra parameters."), @@ -95,7 +92,6 @@ TEST(ChromeUrlRequestContextTest, CreateProxyConfigTest) { GURL(), // pac_url net::ProxyConfig::ProxyRules(), // proxy_rules "", // proxy_bypass_list - false // bypass_local_names }, { TEST_DESC("Single proxy."), @@ -107,7 +103,6 @@ TEST(ChromeUrlRequestContextTest, CreateProxyConfigTest) { GURL(), // pac_url net::MakeSingleProxyRules("http://proxy:8888"), // proxy_rules "", // proxy_bypass_list - false // bypass_local_names }, { TEST_DESC("Per scheme proxy."), @@ -121,7 +116,6 @@ TEST(ChromeUrlRequestContextTest, CreateProxyConfigTest) { "", "ftpproxy:8889"), // proxy_rules "", // proxy_bypass_list - false // bypass_local_names }, { TEST_DESC("Per scheme proxy with bypass URLs."), @@ -134,8 +128,8 @@ TEST(ChromeUrlRequestContextTest, CreateProxyConfigTest) { net::MakeProxyPerSchemeRules("httpproxy:8888", "", "ftpproxy:8889"), // proxy_rules - "*.google.com\n*foo.com:99\n1.2.3.4:22\n127.0.0.1/8\n", - false // bypass_local_names + // TODO(eroman): 127.0.0.1/8 is unsupported, so it was dropped + "*.google.com\nfoo.com:99\n1.2.3.4:22\n", }, { TEST_DESC("Pac URL with proxy bypass URLs"), @@ -146,8 +140,8 @@ TEST(ChromeUrlRequestContextTest, CreateProxyConfigTest) { false, // auto_detect GURL("http://wpad/wpad.dat"), // pac_url net::ProxyConfig::ProxyRules(), // proxy_rules - "*.google.com\n*foo.com:99\n1.2.3.4:22\n127.0.0.1/8\n", - false // bypass_local_names + // TODO(eroman): 127.0.0.1/8 is unsupported, so it was dropped + "*.google.com\nfoo.com:99\n1.2.3.4:22\n", }, { TEST_DESC("Autodetect"), @@ -159,7 +153,6 @@ TEST(ChromeUrlRequestContextTest, CreateProxyConfigTest) { GURL(), // pac_url net::ProxyConfig::ProxyRules(), // proxy_rules "", // proxy_bypass_list - false // bypass_local_names } }; @@ -176,8 +169,7 @@ TEST(ChromeUrlRequestContextTest, CreateProxyConfigTest) { EXPECT_EQ(tests[i].auto_detect, config->auto_detect); EXPECT_EQ(tests[i].pac_url, config->pac_url); EXPECT_EQ(tests[i].proxy_bypass_list, - net::FlattenProxyBypass(config->proxy_bypass)); - EXPECT_EQ(tests[i].bypass_local_names, config->proxy_bypass_local_names); + net::FlattenProxyBypass(config->bypass_rules)); EXPECT_EQ(tests[i].proxy_rules, config->proxy_rules); } } |