From e57ec6f78194e1cd7bb74b47cda1eab065e2d39a Mon Sep 17 00:00:00 2001 From: "wtc@chromium.org" <wtc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> Date: Thu, 14 May 2009 23:17:14 +0000 Subject: Change the host() method of ProxyServer to strip the square brackets around an IPv6 literal address. Rename the method HostNoBrackets() to be consistent with GURL's new HostNoBrackets() method. When resolving an address, use the new HostNoBrackets() method instead of host(). Part of this changelist was contributed by Paul Marks of Google. Original review: http://codereview.chromium.org/115342 R=eroman http://crbug.com/12005 TEST=covered by new test cases in unit test Review URL: http://codereview.chromium.org/114029 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16123 0039d316-1c4b-4281-b951-d872f2087c98 --- net/proxy/proxy_server_unittest.cc | 40 +++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) (limited to 'net/proxy/proxy_server_unittest.cc') diff --git a/net/proxy/proxy_server_unittest.cc b/net/proxy/proxy_server_unittest.cc index 1625a18..ad3fad5 100644 --- a/net/proxy/proxy_server_unittest.cc +++ b/net/proxy/proxy_server_unittest.cc @@ -48,6 +48,44 @@ TEST(ProxyServerTest, FromURI) { "PROXY foopy:10" }, + // IPv6 HTTP proxy URIs: + { + "[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:10", // No scheme. + "[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:10", + net::ProxyServer::SCHEME_HTTP, + "FEDC:BA98:7654:3210:FEDC:BA98:7654:3210", + 10, + "[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:10", + "PROXY [FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:10" + }, + { + "http://[3ffe:2a00:100:7031::1]", // No port. + "[3ffe:2a00:100:7031::1]:80", + net::ProxyServer::SCHEME_HTTP, + "3ffe:2a00:100:7031::1", + 80, + "[3ffe:2a00:100:7031::1]:80", + "PROXY [3ffe:2a00:100:7031::1]:80" + }, + { + "http://[::192.9.5.5]", + "[::192.9.5.5]:80", + net::ProxyServer::SCHEME_HTTP, + "::192.9.5.5", + 80, + "[::192.9.5.5]:80", + "PROXY [::192.9.5.5]:80" + }, + { + "http://[::FFFF:129.144.52.38]:80", + "[::FFFF:129.144.52.38]:80", + net::ProxyServer::SCHEME_HTTP, + "::FFFF:129.144.52.38", + 80, + "[::FFFF:129.144.52.38]:80", + "PROXY [::FFFF:129.144.52.38]:80" + }, + // SOCKS4 proxy URIs: { "socks4://foopy", // No port. @@ -95,7 +133,7 @@ TEST(ProxyServerTest, FromURI) { EXPECT_FALSE(uri.is_direct()); EXPECT_EQ(tests[i].expected_uri, uri.ToURI()); EXPECT_EQ(tests[i].expected_scheme, uri.scheme()); - EXPECT_EQ(tests[i].expected_host, uri.host()); + EXPECT_EQ(tests[i].expected_host, uri.HostNoBrackets()); EXPECT_EQ(tests[i].expected_port, uri.port()); EXPECT_EQ(tests[i].expected_host_and_port, uri.host_and_port()); EXPECT_EQ(tests[i].expected_pac_string, uri.ToPacString()); -- cgit v1.1