diff options
author | rch@chromium.org <rch@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-03 19:52:09 +0000 |
---|---|---|
committer | rch@chromium.org <rch@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-03 19:52:09 +0000 |
commit | fe3b7dcbf673b546635034947e217011724861be (patch) | |
tree | 5698d44f161e81afe8764272f37c7c7de2bd7a4b /net/socket | |
parent | 86cd9471cfdcbe7d308630d0a9268108ca545f9d (diff) | |
download | chromium_src-fe3b7dcbf673b546635034947e217011724861be.zip chromium_src-fe3b7dcbf673b546635034947e217011724861be.tar.gz chromium_src-fe3b7dcbf673b546635034947e217011724861be.tar.bz2 |
Revert 118950 - Allow chrome to handle 407 auth challenges to CONNECT requests
through HTTPS Proxies. This also changes the mechanism used
to restart HttpProxyClientSocket requests with auth. Previously
the transport socket would be Disconnected, and then re-Connected
(which was not implemented for SSLClientSockets). However, the
approach was problematic in the face of, for example, ipv6. The
new approach is to close the HttpProxyClientSocket, and request
a new socket from the pool.
Initially was http://codereview.chromium.org/8502024
which turned out to have problems with NTLM auth.
Review URL: http://codereview.chromium.org/9148011
TBR=rch@chromium.org
Review URL: https://chromiumcodereview.appspot.com/9316101
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@120370 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/socket')
-rw-r--r-- | net/socket/client_socket_pool_manager.cc | 20 | ||||
-rw-r--r-- | net/socket/client_socket_pool_manager.h | 9 | ||||
-rw-r--r-- | net/socket/ssl_client_socket_pool.cc | 4 | ||||
-rw-r--r-- | net/socket/ssl_client_socket_pool_unittest.cc | 16 |
4 files changed, 15 insertions, 34 deletions
diff --git a/net/socket/client_socket_pool_manager.cc b/net/socket/client_socket_pool_manager.cc index b65cb83..7098864 100644 --- a/net/socket/client_socket_pool_manager.cc +++ b/net/socket/client_socket_pool_manager.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -52,7 +52,6 @@ int InitSocketPoolHelper(const GURL& request_url, const BoundNetLog& net_log, int num_preconnect_streams, ClientSocketHandle* socket_handle, - TunnelAuthCallback auth_needed_callback, const CompletionCallback& callback) { scoped_refptr<TransportSocketParams> tcp_params; scoped_refptr<HttpProxySocketParams> http_proxy_params; @@ -137,8 +136,7 @@ int InitSocketPoolHelper(const GURL& request_url, session->http_auth_cache(), session->http_auth_handler_factory(), session->spdy_session_pool(), - force_tunnel || using_ssl, - auth_needed_callback); + force_tunnel || using_ssl); } else { DCHECK(proxy_info.is_socks()); char socks_version; @@ -291,15 +289,13 @@ int InitSocketHandleForHttpRequest( const SSLConfig& ssl_config_for_proxy, const BoundNetLog& net_log, ClientSocketHandle* socket_handle, - TunnelAuthCallback auth_needed_callback, const CompletionCallback& callback) { - DCHECK(socket_handle); return InitSocketPoolHelper( request_url, request_extra_headers, request_load_flags, request_priority, session, proxy_info, force_spdy_over_ssl, want_spdy_over_npn, ssl_config_for_origin, ssl_config_for_proxy, false, net_log, 0, - socket_handle, auth_needed_callback, callback); + socket_handle, callback); } int InitSocketHandleForRawConnect( @@ -310,7 +306,6 @@ int InitSocketHandleForRawConnect( const SSLConfig& ssl_config_for_proxy, const BoundNetLog& net_log, ClientSocketHandle* socket_handle, - TunnelAuthCallback auth_needed_callback, const CompletionCallback& callback) { DCHECK(socket_handle); // Synthesize an HttpRequestInfo. @@ -318,11 +313,11 @@ int InitSocketHandleForRawConnect( HttpRequestHeaders request_extra_headers; int request_load_flags = 0; RequestPriority request_priority = MEDIUM; + return InitSocketPoolHelper( request_url, request_extra_headers, request_load_flags, request_priority, session, proxy_info, false, false, ssl_config_for_origin, - ssl_config_for_proxy, true, net_log, 0, socket_handle, - auth_needed_callback, callback); + ssl_config_for_proxy, true, net_log, 0, socket_handle, callback); } int PreconnectSocketsForHttpRequest( @@ -337,13 +332,12 @@ int PreconnectSocketsForHttpRequest( const SSLConfig& ssl_config_for_origin, const SSLConfig& ssl_config_for_proxy, const BoundNetLog& net_log, - int num_preconnect_streams, - TunnelAuthCallback auth_needed_callback) { + int num_preconnect_streams) { return InitSocketPoolHelper( request_url, request_extra_headers, request_load_flags, request_priority, session, proxy_info, force_spdy_over_ssl, want_spdy_over_npn, ssl_config_for_origin, ssl_config_for_proxy, false, net_log, - num_preconnect_streams, NULL, auth_needed_callback, CompletionCallback()); + num_preconnect_streams, NULL, CompletionCallback()); } } // namespace net diff --git a/net/socket/client_socket_pool_manager.h b/net/socket/client_socket_pool_manager.h index f025e56..7c1f865 100644 --- a/net/socket/client_socket_pool_manager.h +++ b/net/socket/client_socket_pool_manager.h @@ -1,4 +1,4 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // @@ -13,7 +13,6 @@ #include "net/base/completion_callback.h" #include "net/base/net_export.h" #include "net/base/request_priority.h" -#include "net/http/http_proxy_client_socket_pool.h" class GURL; @@ -27,6 +26,7 @@ class BoundNetLog; class ClientSocketHandle; class HostPortPair; class HttpNetworkSession; +class HttpProxyClientSocketPool; class HttpRequestHeaders; class ProxyInfo; class TransportClientSocketPool; @@ -88,7 +88,6 @@ int InitSocketHandleForHttpRequest( const SSLConfig& ssl_config_for_proxy, const BoundNetLog& net_log, ClientSocketHandle* socket_handle, - TunnelAuthCallback auth_needed_callback, const CompletionCallback& callback); // A helper method that uses the passed in proxy information to initialize a @@ -103,7 +102,6 @@ NET_EXPORT int InitSocketHandleForRawConnect( const SSLConfig& ssl_config_for_proxy, const BoundNetLog& net_log, ClientSocketHandle* socket_handle, - TunnelAuthCallback auth_needed_callback, const CompletionCallback& callback); // Similar to InitSocketHandleForHttpRequest except that it initiates the @@ -120,8 +118,7 @@ int PreconnectSocketsForHttpRequest( const SSLConfig& ssl_config_for_origin, const SSLConfig& ssl_config_for_proxy, const BoundNetLog& net_log, - int num_preconnect_streams, - TunnelAuthCallback auth_needed_callback); + int num_preconnect_streams); } // namespace net diff --git a/net/socket/ssl_client_socket_pool.cc b/net/socket/ssl_client_socket_pool.cc index 33a0d70..53f7f97 100644 --- a/net/socket/ssl_client_socket_pool.cc +++ b/net/socket/ssl_client_socket_pool.cc @@ -258,8 +258,8 @@ int SSLConnectJob::DoTunnelConnectComplete(int result) { } else if (result == ERR_PROXY_AUTH_REQUESTED || result == ERR_HTTPS_PROXY_TUNNEL_RESPONSE) { StreamSocket* socket = transport_socket_handle_->socket(); - ProxyClientSocket* tunnel_socket = - static_cast<ProxyClientSocket*>(socket); + HttpProxyClientSocket* tunnel_socket = + static_cast<HttpProxyClientSocket*>(socket); error_response_info_ = *tunnel_socket->GetConnectResponseInfo(); } if (result < 0) diff --git a/net/socket/ssl_client_socket_pool_unittest.cc b/net/socket/ssl_client_socket_pool_unittest.cc index 53e6382..c751a4a 100644 --- a/net/socket/ssl_client_socket_pool_unittest.cc +++ b/net/socket/ssl_client_socket_pool_unittest.cc @@ -1,8 +1,8 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "net/socket/ssl_client_socket_pool.h" +#include "net/http/http_proxy_client_socket_pool.h" #include "base/callback.h" #include "base/compiler_specific.h" @@ -19,7 +19,6 @@ #include "net/base/test_completion_callback.h" #include "net/http/http_auth_handler_factory.h" #include "net/http/http_network_session.h" -#include "net/http/http_proxy_client_socket_pool.h" #include "net/http/http_request_headers.h" #include "net/http/http_response_headers.h" #include "net/http/http_server_properties_impl.h" @@ -72,9 +71,7 @@ class SSLClientSocketPoolTest : public testing::Test { session_->http_auth_cache(), session_->http_auth_handler_factory(), session_->spdy_session_pool(), - true, - base::Bind(&SSLClientSocketPoolTest::OnNeedsProxyAuthCallback, - base::Unretained(this)))), + true)), http_proxy_histograms_("MockHttpProxy"), http_proxy_socket_pool_( kMaxSockets, @@ -147,13 +144,6 @@ class SSLClientSocketPoolTest : public testing::Test { return new HttpNetworkSession(params); } - void OnNeedsProxyAuthCallback(const HttpResponseInfo& response_info, - HttpAuthController* auth_controller, - CompletionCallback cb) { - // Don't add any auth, just execute the callback. - cb.Run(OK); - } - MockClientSocketFactory socket_factory_; MockCachingHostResolver host_resolver_; CertVerifier cert_verifier_; |