diff options
author | eroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-16 20:53:01 +0000 |
---|---|---|
committer | eroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-16 20:53:01 +0000 |
commit | f7fcceefed4e4817f3fca6fdd2156136662ae39b (patch) | |
tree | 49f5d7736c5031f1a7036182f623cacfe6014186 /net | |
parent | 92c6d20388d078771d35a56cfa4b54e080df40d0 (diff) | |
download | chromium_src-f7fcceefed4e4817f3fca6fdd2156136662ae39b.zip chromium_src-f7fcceefed4e4817f3fca6fdd2156136662ae39b.tar.gz chromium_src-f7fcceefed4e4817f3fca6fdd2156136662ae39b.tar.bz2 |
Add a new net error code for when the load failure was due to connecting to a bad proxy server.
Prior to this change, users would likely have seen one of these errors on failure to connect through a proxy server:
ERR_NAME_NOT_RESOLVED
ERR_ADDRESS_UNREACHABLE
ERR_CONNECTION_REFUSED
ERR_CONNECTION_TIMED_OUT
ERR_CONNECTION_FAILED
Whereas now any host resolve or tcp connect error will map to:
ERR_PROXY_UNREACHABLE
This error code will allow selecting a more suitable error page.
BUG=53477
Review URL: http://codereview.chromium.org/3360025
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@59710 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r-- | net/base/net_error_list.h | 6 | ||||
-rw-r--r-- | net/http/http_network_transaction_unittest.cc | 2 | ||||
-rw-r--r-- | net/http/http_proxy_client_socket_pool.cc | 4 | ||||
-rw-r--r-- | net/http/http_proxy_client_socket_pool_unittest.cc | 6 | ||||
-rw-r--r-- | net/http/http_stream_request.cc | 1 | ||||
-rw-r--r-- | net/socket/socks_client_socket_pool.cc | 2 | ||||
-rw-r--r-- | net/socket/socks_client_socket_pool_unittest.cc | 4 | ||||
-rw-r--r-- | net/socket/ssl_client_socket_pool_unittest.cc | 4 |
8 files changed, 21 insertions, 8 deletions
diff --git a/net/base/net_error_list.h b/net/base/net_error_list.h index b254204..7f2a6c2 100644 --- a/net/base/net_error_list.h +++ b/net/base/net_error_list.h @@ -171,6 +171,12 @@ NET_ERROR(SSL_UNSAFE_NEGOTIATION, -128) // The SSL server attempted to use a weak ephemeral Diffie-Hellman key. NET_ERROR(SSL_WEAK_SERVER_EPHEMERAL_DH_KEY, -129) +// Could not create a TCP connection to the proxy server. An error occurred +// either in resolving its name, or in connecting a socket to it. +// Note that this does NOT include failures during the actual "CONNECT" method +// of an HTTP proxy. +NET_ERROR(PROXY_CONNECTION_FAILED, -130) + // Certificate error codes // // The values of certificate error codes must be consecutive. diff --git a/net/http/http_network_transaction_unittest.cc b/net/http/http_network_transaction_unittest.cc index 47d4842..d2a35bc 100644 --- a/net/http/http_network_transaction_unittest.cc +++ b/net/http/http_network_transaction_unittest.cc @@ -4910,7 +4910,7 @@ TEST_F(HttpNetworkTransactionTest, ReconsiderProxyAfterFailedConnection) { EXPECT_EQ(ERR_IO_PENDING, rv); rv = callback.WaitForResult(); - EXPECT_EQ(ERR_NAME_NOT_RESOLVED, rv); + EXPECT_EQ(ERR_PROXY_CONNECTION_FAILED, rv); } // Host resolution observer used by diff --git a/net/http/http_proxy_client_socket_pool.cc b/net/http/http_proxy_client_socket_pool.cc index 42722d2..13f4519 100644 --- a/net/http/http_proxy_client_socket_pool.cc +++ b/net/http/http_proxy_client_socket_pool.cc @@ -155,7 +155,7 @@ int HttpProxyConnectJob::DoTCPConnect() { int HttpProxyConnectJob::DoTCPConnectComplete(int result) { if (result != OK) - return result; + return ERR_PROXY_CONNECTION_FAILED; // Reset the timer to just the length of time allowed for HttpProxy handshake // so that a fast TCP connection plus a slow HttpProxy failure doesn't take @@ -180,6 +180,8 @@ int HttpProxyConnectJob::DoSSLConnectComplete(int result) { params_->ssl_params()->load_flags() & LOAD_IGNORE_ALL_CERT_ERRORS) result = OK; if (result < 0) { + // TODO(eroman): return ERR_PROXY_CONNECTION_FAILED if failed with the + // TCP connection. if (transport_socket_handle_->socket()) transport_socket_handle_->socket()->Disconnect(); return result; diff --git a/net/http/http_proxy_client_socket_pool_unittest.cc b/net/http/http_proxy_client_socket_pool_unittest.cc index a1190cb..b375c7e 100644 --- a/net/http/http_proxy_client_socket_pool_unittest.cc +++ b/net/http/http_proxy_client_socket_pool_unittest.cc @@ -250,7 +250,11 @@ TEST_P(HttpProxyClientSocketPoolTest, TCPError) { EXPECT_FALSE(handle.is_initialized()); EXPECT_FALSE(handle.socket()); - EXPECT_EQ(ERR_CONNECTION_CLOSED, callback.WaitForResult()); + if (GetParam() == HTTP) + EXPECT_EQ(ERR_PROXY_CONNECTION_FAILED, callback.WaitForResult()); + else + EXPECT_EQ(ERR_CONNECTION_CLOSED, callback.WaitForResult()); + EXPECT_FALSE(handle.is_initialized()); EXPECT_FALSE(handle.socket()); } diff --git a/net/http/http_stream_request.cc b/net/http/http_stream_request.cc index 09bedbc..64110a7 100644 --- a/net/http/http_stream_request.cc +++ b/net/http/http_stream_request.cc @@ -839,6 +839,7 @@ int HttpStreamRequest::ReconsiderProxyAfterError(int error) { // now exists that corresponds to a proxy server that could load the URL. // switch (error) { + case ERR_PROXY_CONNECTION_FAILED: case ERR_NAME_NOT_RESOLVED: case ERR_INTERNET_DISCONNECTED: case ERR_ADDRESS_UNREACHABLE: diff --git a/net/socket/socks_client_socket_pool.cc b/net/socket/socks_client_socket_pool.cc index 20493b3..60f8665 100644 --- a/net/socket/socks_client_socket_pool.cc +++ b/net/socket/socks_client_socket_pool.cc @@ -128,7 +128,7 @@ int SOCKSConnectJob::DoTCPConnect() { int SOCKSConnectJob::DoTCPConnectComplete(int result) { if (result != OK) - return result; + return ERR_PROXY_CONNECTION_FAILED; // Reset the timer to just the length of time allowed for SOCKS handshake // so that a fast TCP connection plus a slow SOCKS failure doesn't take diff --git a/net/socket/socks_client_socket_pool_unittest.cc b/net/socket/socks_client_socket_pool_unittest.cc index 14e2bee..c81e8dca 100644 --- a/net/socket/socks_client_socket_pool_unittest.cc +++ b/net/socket/socks_client_socket_pool_unittest.cc @@ -119,7 +119,7 @@ TEST_F(SOCKSClientSocketPoolTest, TCPConnectError) { ClientSocketHandle handle; int rv = handle.Init("a", ignored_socket_params_, LOW, NULL, pool_, BoundNetLog()); - EXPECT_EQ(ERR_CONNECTION_REFUSED, rv); + EXPECT_EQ(ERR_PROXY_CONNECTION_FAILED, rv); EXPECT_FALSE(handle.is_initialized()); EXPECT_FALSE(handle.socket()); } @@ -137,7 +137,7 @@ TEST_F(SOCKSClientSocketPoolTest, AsyncTCPConnectError) { EXPECT_FALSE(handle.is_initialized()); EXPECT_FALSE(handle.socket()); - EXPECT_EQ(ERR_CONNECTION_REFUSED, callback.WaitForResult()); + EXPECT_EQ(ERR_PROXY_CONNECTION_FAILED, callback.WaitForResult()); EXPECT_FALSE(handle.is_initialized()); EXPECT_FALSE(handle.socket()); } diff --git a/net/socket/ssl_client_socket_pool_unittest.cc b/net/socket/ssl_client_socket_pool_unittest.cc index 378356d..76ed518 100644 --- a/net/socket/ssl_client_socket_pool_unittest.cc +++ b/net/socket/ssl_client_socket_pool_unittest.cc @@ -461,7 +461,7 @@ TEST_F(SSLClientSocketPoolTest, HttpProxyFail) { ClientSocketHandle handle; TestCompletionCallback callback; int rv = handle.Init("a", params, MEDIUM, &callback, pool_, BoundNetLog()); - EXPECT_EQ(ERR_CONNECTION_FAILED, rv); + EXPECT_EQ(ERR_PROXY_CONNECTION_FAILED, rv); EXPECT_FALSE(handle.is_initialized()); EXPECT_FALSE(handle.socket()); EXPECT_FALSE(handle.is_ssl_error()); @@ -483,7 +483,7 @@ TEST_F(SSLClientSocketPoolTest, HttpProxyFailAsync) { EXPECT_FALSE(handle.is_initialized()); EXPECT_FALSE(handle.socket()); - EXPECT_EQ(ERR_CONNECTION_FAILED, callback.WaitForResult()); + EXPECT_EQ(ERR_PROXY_CONNECTION_FAILED, callback.WaitForResult()); EXPECT_FALSE(handle.is_initialized()); EXPECT_FALSE(handle.socket()); EXPECT_FALSE(handle.is_ssl_error()); |