From e60e47ad57e7ff423c39cff9c88725a7aed85118 Mon Sep 17 00:00:00 2001 From: "vandebo@chromium.org" Date: Wed, 14 Jul 2010 03:37:18 +0000 Subject: Implement SSLClientSocketPool. To support SSLClientSocketPool, ClientSocketPoolBase and ClientSocketHandle require a notion of additional error state reported from the pool. Overtime the error handling may get become more integrated, alleviating the need for some of the additional error state. To support getting Http Proxy credentials from the user, the SSLClientSocketPool will release unauthenticated HttpProxyClientSocket's into the pool as idle. However, it checks their authentication status when receiving one, completing the authentication once the user has provided the credentials. BUG=30357 TEST=existing unit tests, ClientSocketPoolBaseTest.AdditionalErrorState*, SSLClientSocketPoolTest.* Review URL: http://codereview.chromium.org/2870030 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@52275 0039d316-1c4b-4281-b951-d872f2087c98 --- net/http/http_network_session.h | 44 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 42 insertions(+), 2 deletions(-) (limited to 'net/http/http_network_session.h') diff --git a/net/http/http_network_session.h b/net/http/http_network_session.h index 5f1b869..de57eba 100644 --- a/net/http/http_network_session.h +++ b/net/http/http_network_session.h @@ -21,6 +21,7 @@ #include "net/proxy/proxy_service.h" #include "net/socket/client_socket_pool_histograms.h" #include "net/socket/socks_client_socket_pool.h" +#include "net/socket/ssl_client_socket_pool.h" #include "net/socket/tcp_client_socket_pool.h" #include "net/spdy/spdy_settings_storage.h" @@ -71,12 +72,19 @@ class HttpNetworkSession : public base::RefCounted, return tcp_socket_pool_; } + const scoped_refptr& ssl_socket_pool() { + return ssl_socket_pool_; + } + const scoped_refptr& GetSocketPoolForSOCKSProxy( const HostPortPair& socks_proxy); const scoped_refptr& GetSocketPoolForHTTPProxy( const HostPortPair& http_proxy); + const scoped_refptr& GetSocketPoolForSSLWithProxy( + const HostPortPair& proxy_server); + // SSL sockets come from the socket_factory(). ClientSocketFactory* socket_factory() { return socket_factory_; } HostResolver* host_resolver() { return host_resolver_; } @@ -100,11 +108,40 @@ class HttpNetworkSession : public base::RefCounted, static uint16 fixed_https_port(); static void set_fixed_https_port(uint16 port); +#ifdef UNIT_TEST + void FlushSocketPools() { + if (ssl_socket_pool_.get()) + ssl_socket_pool_->Flush(); + if (tcp_socket_pool_.get()) + tcp_socket_pool_->Flush(); + + for (SSLSocketPoolMap::const_iterator it = + ssl_socket_pools_for_proxies_.begin(); + it != ssl_socket_pools_for_proxies_.end(); + it++) + it->second->Flush(); + + for (SOCKSSocketPoolMap::const_iterator it = + socks_socket_pools_.begin(); + it != socks_socket_pools_.end(); + it++) + it->second->Flush(); + + for (HTTPProxySocketPoolMap::const_iterator it = + http_proxy_socket_pools_.begin(); + it != http_proxy_socket_pools_.end(); + it++) + it->second->Flush(); + } +#endif + private: typedef std::map > HTTPProxySocketPoolMap; typedef std::map > SOCKSSocketPoolMap; + typedef std::map > + SSLSocketPoolMap; friend class base::RefCounted; friend class HttpNetworkSessionPeer; @@ -119,9 +156,12 @@ class HttpNetworkSession : public base::RefCounted, scoped_refptr http_proxy_pool_histograms_; scoped_refptr tcp_for_socks_pool_histograms_; scoped_refptr socks_pool_histograms_; + scoped_refptr ssl_pool_histograms_; scoped_refptr tcp_socket_pool_; - HTTPProxySocketPoolMap http_proxy_socket_pool_; - SOCKSSocketPoolMap socks_socket_pool_; + scoped_refptr ssl_socket_pool_; + HTTPProxySocketPoolMap http_proxy_socket_pools_; + SOCKSSocketPoolMap socks_socket_pools_; + SSLSocketPoolMap ssl_socket_pools_for_proxies_; ClientSocketFactory* socket_factory_; scoped_refptr host_resolver_; scoped_refptr proxy_service_; -- cgit v1.1