From 69719063c6ddf24d63762a5519efb11dc412a3ee Mon Sep 17 00:00:00 2001 From: "eroman@chromium.org" Date: Tue, 5 Jan 2010 20:09:21 +0000 Subject: Remove the implicit fallback to DIRECT when proxies fail. This better matches other browsers, and simplifies the code. To better understand what this means, here are some examples how the behaviors will differ for the user: (1) You start chrome with --proxy-server="foobar:80". The server "foobar:80" is refusing connections. Before: Would fallback to direct after failing to connect through foobar:80. Now: Will error-out with connection refused after failing to connect through foobar:80. (2) You start chrome with --proxy-pac-url="file:///foobar.pac". The server "foobar:80" is unreachable, and foobar.pac reads: function FindProxyForURL(url, host) { return "PROXY foobar:80"; } Before: Would fallback to direct after failing to connect through foobar:80. Now: Will error-out with connection refused after failing to connect through foobar:80. (3) You start chrome with --proxy-pac-url="file:///foobar.pac". The server "foobar:80" is unreachable, and foobar.pac reads: function FindProxyForURL(url, host) { return "PROXY foobar:80; DIRECT"; } *No change, since the fallback to DIRECT is explicit in the PAC script* BUG=12303 Review URL: http://codereview.chromium.org/502068 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@35549 0039d316-1c4b-4281-b951-d872f2087c98 --- net/proxy/proxy_list_unittest.cc | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'net/proxy/proxy_list_unittest.cc') diff --git a/net/proxy/proxy_list_unittest.cc b/net/proxy/proxy_list_unittest.cc index c52381e..401461f 100644 --- a/net/proxy/proxy_list_unittest.cc +++ b/net/proxy/proxy_list_unittest.cc @@ -24,9 +24,20 @@ TEST(ProxyListTest, SetFromPacString) { { "proxy foopy1 ; SOCKS foopy2", "PROXY foopy1:80;SOCKS foopy2:1080", }, + // Try putting DIRECT first. + { "DIRECT ; proxy foopy1 ; DIRECT ; SOCKS5 foopy2;DIRECT ", + "DIRECT;PROXY foopy1:80;DIRECT;SOCKS5 foopy2:1080;DIRECT", + }, + // Try putting DIRECT consecutively. + { "DIRECT ; proxy foopy1:80; DIRECT ; DIRECT", + "DIRECT;PROXY foopy1:80;DIRECT;DIRECT", + }, // Invalid inputs (parts which aren't understood get // silently discarded): + // + // If the proxy list string parsed to empty, automatically fall-back to + // DIRECT. { "PROXY-foopy:10", "DIRECT", }, @@ -42,6 +53,7 @@ TEST(ProxyListTest, SetFromPacString) { net::ProxyList list; list.SetFromPacString(tests[i].pac_input); EXPECT_EQ(tests[i].pac_output, list.ToPacString()); + EXPECT_FALSE(list.IsEmpty()); } } @@ -56,10 +68,10 @@ TEST(ProxyListTest, RemoveProxiesWithoutScheme) { net::ProxyServer::SCHEME_DIRECT | net::ProxyServer::SCHEME_HTTP, "PROXY foopy:10;PROXY foopy3:80;DIRECT", }, - { "PROXY foopy:10 | SOCKS5 foopy2", + { "PROXY foopy:10 ; SOCKS5 foopy2", // Remove anything that isn't HTTP or SOCKS5. net::ProxyServer::SCHEME_DIRECT | net::ProxyServer::SCHEME_SOCKS4, - "DIRECT", + "", }, }; -- cgit v1.1