diff options
author | agl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-18 13:45:12 +0000 |
---|---|---|
committer | agl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-18 13:45:12 +0000 |
commit | 8c9d4ba6af47099c5ce030d0802b276cd8fd37b2 (patch) | |
tree | 8fb914c374db9631a749475180036df83e2ed9a9 /net/http | |
parent | 971888bc3cefb8dc5538c7785a4b2c82f706a2a5 (diff) | |
download | chromium_src-8c9d4ba6af47099c5ce030d0802b276cd8fd37b2.zip chromium_src-8c9d4ba6af47099c5ce030d0802b276cd8fd37b2.tar.gz chromium_src-8c9d4ba6af47099c5ce030d0802b276cd8fd37b2.tar.bz2 |
Revert 62918 - net: clean up SSLHostInfo construction.
Create an SSLHostInfoFactory interface and plumb it from the HttpCache
to the SSLConnectJob. Also, move the SSLHostInfo reference from the
ssl_config to being passed to the SSLClientSocket.
BUG=none
TEST=net_unittests
Review URL: http://codereview.chromium.org/3747003
TBR=agl@chromium.org
Review URL: http://codereview.chromium.org/3846005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@62922 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/http')
-rw-r--r-- | net/http/disk_cache_based_ssl_host_info.cc | 3 | ||||
-rw-r--r-- | net/http/http_cache.cc | 23 | ||||
-rw-r--r-- | net/http/http_cache.h | 5 | ||||
-rw-r--r-- | net/http/http_cache_transaction.cc | 10 | ||||
-rw-r--r-- | net/http/http_network_layer.cc | 11 | ||||
-rw-r--r-- | net/http/http_network_layer.h | 5 | ||||
-rw-r--r-- | net/http/http_network_layer_unittest.cc | 3 | ||||
-rw-r--r-- | net/http/http_network_session.cc | 2 | ||||
-rw-r--r-- | net/http/http_network_session.h | 2 | ||||
-rw-r--r-- | net/http/http_network_transaction.cc | 4 | ||||
-rw-r--r-- | net/http/http_network_transaction.h | 2 | ||||
-rw-r--r-- | net/http/http_network_transaction_unittest.cc | 7 | ||||
-rw-r--r-- | net/http/http_proxy_client_socket_pool_unittest.cc | 2 | ||||
-rw-r--r-- | net/http/http_response_body_drainer_unittest.cc | 1 |
14 files changed, 23 insertions, 57 deletions
diff --git a/net/http/disk_cache_based_ssl_host_info.cc b/net/http/disk_cache_based_ssl_host_info.cc index f2de223..61ee450 100644 --- a/net/http/disk_cache_based_ssl_host_info.cc +++ b/net/http/disk_cache_based_ssl_host_info.cc @@ -34,8 +34,7 @@ void DiskCacheBasedSSLHostInfo::Start() { DiskCacheBasedSSLHostInfo::~DiskCacheBasedSSLHostInfo() { DCHECK(!user_callback_); - if (entry_) - entry_->Close(); + DCHECK(!entry_); callback_->Cancel(); } diff --git a/net/http/http_cache.cc b/net/http/http_cache.cc index 8098ebd..867d003 100644 --- a/net/http/http_cache.cc +++ b/net/http/http_cache.cc @@ -24,9 +24,7 @@ #include "net/base/io_buffer.h" #include "net/base/load_flags.h" #include "net/base/net_errors.h" -#include "net/base/ssl_host_info.h" #include "net/disk_cache/disk_cache.h" -#include "net/http/disk_cache_based_ssl_host_info.h" #include "net/http/http_cache_transaction.h" #include "net/http/http_network_layer.h" #include "net/http/http_network_session.h" @@ -244,22 +242,6 @@ void HttpCache::MetadataWriter::OnIOComplete(int result) { //----------------------------------------------------------------------------- -class HttpCache::SSLHostInfoFactoryAdaptor : public SSLHostInfoFactory { - public: - SSLHostInfoFactoryAdaptor(HttpCache* http_cache) - : http_cache_(http_cache) { - } - - SSLHostInfo* GetForHost(const std::string& hostname) { - return new DiskCacheBasedSSLHostInfo(hostname, http_cache_); - } - - private: - HttpCache* const http_cache_; -}; - -//----------------------------------------------------------------------------- - HttpCache::HttpCache(HostResolver* host_resolver, DnsRRResolver* dnsrr_resolver, ProxyService* proxy_service, @@ -271,11 +253,8 @@ HttpCache::HttpCache(HostResolver* host_resolver, : backend_factory_(backend_factory), building_backend_(false), mode_(NORMAL), - ssl_host_info_factory_(new SSLHostInfoFactoryAdaptor( - ALLOW_THIS_IN_INITIALIZER_LIST(this))), network_layer_(HttpNetworkLayer::CreateFactory(host_resolver, - dnsrr_resolver, ssl_host_info_factory_.get(), - proxy_service, ssl_config_service, + dnsrr_resolver, proxy_service, ssl_config_service, http_auth_handler_factory, network_delegate, net_log)), ALLOW_THIS_IN_INITIALIZER_LIST(task_factory_(this)), enable_range_support_(true) { diff --git a/net/http/http_cache.h b/net/http/http_cache.h index 1406cd0..775d035 100644 --- a/net/http/http_cache.h +++ b/net/http/http_cache.h @@ -116,7 +116,7 @@ class HttpCache : public HttpTransactionFactory, }; // The disk cache is initialized lazily (by CreateTransaction) in this case. - // The HttpCache takes ownership of the |backend_factory|. + // The HttpCache takes ownership of the |backend_factory|. HttpCache(HostResolver* host_resolver, DnsRRResolver* dnsrr_resolver, ProxyService* proxy_service, @@ -200,7 +200,6 @@ class HttpCache : public HttpTransactionFactory, class BackendCallback; class MetadataWriter; - class SSLHostInfoFactoryAdaptor; class Transaction; class WorkItem; friend class Transaction; @@ -354,8 +353,6 @@ class HttpCache : public HttpTransactionFactory, Mode mode_; - scoped_ptr<SSLHostInfoFactoryAdaptor> ssl_host_info_factory_; - scoped_ptr<HttpTransactionFactory> network_layer_; scoped_ptr<disk_cache::Backend> disk_cache_; diff --git a/net/http/http_cache_transaction.cc b/net/http/http_cache_transaction.cc index 58288f4..6550703 100644 --- a/net/http/http_cache_transaction.cc +++ b/net/http/http_cache_transaction.cc @@ -625,6 +625,16 @@ int HttpCache::Transaction::DoSendRequest() { return rv; next_state_ = STATE_SEND_REQUEST_COMPLETE; + if (request_->url.SchemeIs("https") && + SSLConfigService::snap_start_enabled()) { + // TODO(agl): in order to support AlternateProtocol there should probably + // be an object hanging off the HttpNetworkSession which constructs these. + // Note: when this test is removed, don't forget to remove the #include of + // ssl_config_service.h + scoped_refptr<DiskCacheBasedSSLHostInfo> hostinfo = + new DiskCacheBasedSSLHostInfo(request_->url.host(), cache_); + network_trans_->SetSSLHostInfo(hostinfo.get()); + } rv = network_trans_->Start(request_, &io_callback_, net_log_); return rv; } diff --git a/net/http/http_network_layer.cc b/net/http/http_network_layer.cc index 5322e85..0f53d4c 100644 --- a/net/http/http_network_layer.cc +++ b/net/http/http_network_layer.cc @@ -22,7 +22,6 @@ namespace net { HttpTransactionFactory* HttpNetworkLayer::CreateFactory( HostResolver* host_resolver, DnsRRResolver* dnsrr_resolver, - SSLHostInfoFactory* ssl_host_info_factory, ProxyService* proxy_service, SSLConfigService* ssl_config_service, HttpAuthHandlerFactory* http_auth_handler_factory, @@ -31,8 +30,7 @@ HttpTransactionFactory* HttpNetworkLayer::CreateFactory( DCHECK(proxy_service); return new HttpNetworkLayer(ClientSocketFactory::GetDefaultFactory(), - host_resolver, dnsrr_resolver, - ssl_host_info_factory, proxy_service, + host_resolver, dnsrr_resolver, proxy_service, ssl_config_service, http_auth_handler_factory, network_delegate, net_log); @@ -51,7 +49,6 @@ HttpNetworkLayer::HttpNetworkLayer( ClientSocketFactory* socket_factory, HostResolver* host_resolver, DnsRRResolver* dnsrr_resolver, - SSLHostInfoFactory* ssl_host_info_factory, ProxyService* proxy_service, SSLConfigService* ssl_config_service, HttpAuthHandlerFactory* http_auth_handler_factory, @@ -60,7 +57,6 @@ HttpNetworkLayer::HttpNetworkLayer( : socket_factory_(socket_factory), host_resolver_(host_resolver), dnsrr_resolver_(dnsrr_resolver), - ssl_host_info_factory_(ssl_host_info_factory), proxy_service_(proxy_service), ssl_config_service_(ssl_config_service), session_(NULL), @@ -77,7 +73,6 @@ HttpNetworkLayer::HttpNetworkLayer( ClientSocketFactory* socket_factory, HostResolver* host_resolver, DnsRRResolver* dnsrr_resolver, - SSLHostInfoFactory* ssl_host_info_factory, ProxyService* proxy_service, SSLConfigService* ssl_config_service, SpdySessionPool* spdy_session_pool, @@ -87,7 +82,6 @@ HttpNetworkLayer::HttpNetworkLayer( : socket_factory_(socket_factory), host_resolver_(host_resolver), dnsrr_resolver_(dnsrr_resolver), - ssl_host_info_factory_(ssl_host_info_factory), proxy_service_(proxy_service), ssl_config_service_(ssl_config_service), session_(NULL), @@ -103,7 +97,6 @@ HttpNetworkLayer::HttpNetworkLayer( HttpNetworkLayer::HttpNetworkLayer(HttpNetworkSession* session) : socket_factory_(ClientSocketFactory::GetDefaultFactory()), dnsrr_resolver_(NULL), - ssl_host_info_factory_(NULL), ssl_config_service_(NULL), session_(session), spdy_session_pool_(NULL), @@ -144,7 +137,6 @@ HttpNetworkSession* HttpNetworkLayer::GetSession() { session_ = new HttpNetworkSession( host_resolver_, dnsrr_resolver_, - ssl_host_info_factory_, proxy_service_, socket_factory_, ssl_config_service_, @@ -155,7 +147,6 @@ HttpNetworkSession* HttpNetworkLayer::GetSession() { // These were just temps for lazy-initializing HttpNetworkSession. host_resolver_ = NULL; dnsrr_resolver_ = NULL; - ssl_host_info_factory_ = NULL; proxy_service_ = NULL; socket_factory_ = NULL; http_auth_handler_factory_ = NULL; diff --git a/net/http/http_network_layer.h b/net/http/http_network_layer.h index 63ae3f2..7872fdd 100644 --- a/net/http/http_network_layer.h +++ b/net/http/http_network_layer.h @@ -25,7 +25,6 @@ class NetLog; class ProxyService; class SpdySessionPool; class SSLConfigService; -class SSLHostInfoFactory; class HttpNetworkLayer : public HttpTransactionFactory, public NonThreadSafe { public: @@ -34,7 +33,6 @@ class HttpNetworkLayer : public HttpTransactionFactory, public NonThreadSafe { HttpNetworkLayer(ClientSocketFactory* socket_factory, HostResolver* host_resolver, DnsRRResolver* dnsrr_resolver, - SSLHostInfoFactory* ssl_host_info_factory, ProxyService* proxy_service, SSLConfigService* ssl_config_service, HttpAuthHandlerFactory* http_auth_handler_factory, @@ -46,7 +44,6 @@ class HttpNetworkLayer : public HttpTransactionFactory, public NonThreadSafe { ClientSocketFactory* socket_factory, HostResolver* host_resolver, DnsRRResolver* dnsrr_resolver, - SSLHostInfoFactory* ssl_host_info_factory, ProxyService* proxy_service, SSLConfigService* ssl_config_service, SpdySessionPool* spdy_session_pool, @@ -62,7 +59,6 @@ class HttpNetworkLayer : public HttpTransactionFactory, public NonThreadSafe { static HttpTransactionFactory* CreateFactory( HostResolver* host_resolver, DnsRRResolver* dnsrr_resolver, - SSLHostInfoFactory* ssl_host_info_factory, ProxyService* proxy_service, SSLConfigService* ssl_config_service, HttpAuthHandlerFactory* http_auth_handler_factory, @@ -100,7 +96,6 @@ class HttpNetworkLayer : public HttpTransactionFactory, public NonThreadSafe { // creating |session_|. HostResolver* host_resolver_; DnsRRResolver* dnsrr_resolver_; - SSLHostInfoFactory* ssl_host_info_factory_; scoped_refptr<ProxyService> proxy_service_; // The SSL config service being used for the session. diff --git a/net/http/http_network_layer_unittest.cc b/net/http/http_network_layer_unittest.cc index dadda13..378962e 100644 --- a/net/http/http_network_layer_unittest.cc +++ b/net/http/http_network_layer_unittest.cc @@ -25,7 +25,6 @@ TEST_F(HttpNetworkLayerTest, CreateAndDestroy) { NULL, &host_resolver, NULL /* dnsrr_resolver */, - NULL /* ssl_host_info_factory */, net::ProxyService::CreateDirect(), new net::SSLConfigServiceDefaults, NULL, @@ -44,7 +43,6 @@ TEST_F(HttpNetworkLayerTest, Suspend) { NULL, &host_resolver, NULL /* dnsrr_resolver */, - NULL /* ssl_host_info_factory */, net::ProxyService::CreateDirect(), new net::SSLConfigServiceDefaults, NULL, @@ -92,7 +90,6 @@ TEST_F(HttpNetworkLayerTest, GET) { &mock_socket_factory, &host_resolver, NULL /* dnsrr_resolver */, - NULL /* ssl_host_info_factory */, net::ProxyService::CreateDirect(), new net::SSLConfigServiceDefaults, NULL, diff --git a/net/http/http_network_session.cc b/net/http/http_network_session.cc index d96f901..410d9e6 100644 --- a/net/http/http_network_session.cc +++ b/net/http/http_network_session.cc @@ -21,7 +21,6 @@ namespace net { HttpNetworkSession::HttpNetworkSession( HostResolver* host_resolver, DnsRRResolver* dnsrr_resolver, - SSLHostInfoFactory* ssl_host_info_factory, ProxyService* proxy_service, ClientSocketFactory* client_socket_factory, SSLConfigService* ssl_config_service, @@ -38,7 +37,6 @@ HttpNetworkSession::HttpNetworkSession( client_socket_factory, host_resolver, dnsrr_resolver, - ssl_host_info_factory, proxy_service, ssl_config_service), spdy_session_pool_(spdy_session_pool), diff --git a/net/http/http_network_session.h b/net/http/http_network_session.h index 53ae36a..bf5e98b 100644 --- a/net/http/http_network_session.h +++ b/net/http/http_network_session.h @@ -38,7 +38,6 @@ class HttpResponseBodyDrainer; class SpdySessionPool; class SOCKSClientSocketPool; class SSLClientSocketPool; -class SSLHostInfoFactory; class TCPClientSocketPool; // This class holds session objects used by HttpNetworkTransaction objects. @@ -48,7 +47,6 @@ class HttpNetworkSession : public base::RefCounted<HttpNetworkSession>, HttpNetworkSession( HostResolver* host_resolver, DnsRRResolver* dnsrr_resolver, - SSLHostInfoFactory* ssl_host_info_factory, ProxyService* proxy_service, ClientSocketFactory* client_socket_factory, SSLConfigService* ssl_config_service, diff --git a/net/http/http_network_transaction.cc b/net/http/http_network_transaction.cc index fc1def9..7d43117 100644 --- a/net/http/http_network_transaction.cc +++ b/net/http/http_network_transaction.cc @@ -416,6 +416,10 @@ uint64 HttpNetworkTransaction::GetUploadProgress() const { return stream_->GetUploadProgress(); } +void HttpNetworkTransaction::SetSSLHostInfo(SSLHostInfo* host_info) { + ssl_config_.ssl_host_info = host_info; +} + void HttpNetworkTransaction::OnStreamReady(HttpStream* stream) { DCHECK_EQ(STATE_CREATE_STREAM_COMPLETE, next_state_); DCHECK(stream_request_.get()); diff --git a/net/http/http_network_transaction.h b/net/http/http_network_transaction.h index ce0c5bd..a8d371d 100644 --- a/net/http/http_network_transaction.h +++ b/net/http/http_network_transaction.h @@ -29,6 +29,7 @@ class HttpNetworkSession; class HttpStream; class HttpStreamRequest; class IOBuffer; +class SSLHostInfo; struct HttpRequestInfo; class HttpNetworkTransaction : public HttpTransaction, @@ -55,6 +56,7 @@ class HttpNetworkTransaction : public HttpTransaction, virtual const HttpResponseInfo* GetResponseInfo() const; virtual LoadState GetLoadState() const; virtual uint64 GetUploadProgress() const; + virtual void SetSSLHostInfo(SSLHostInfo* host_info); // StreamRequest::Delegate methods: virtual void OnStreamReady(HttpStream* stream); diff --git a/net/http/http_network_transaction_unittest.cc b/net/http/http_network_transaction_unittest.cc index 2066264..a128b3d 100644 --- a/net/http/http_network_transaction_unittest.cc +++ b/net/http/http_network_transaction_unittest.cc @@ -99,7 +99,6 @@ struct SessionDependencies { HttpNetworkSession* CreateSession(SessionDependencies* session_deps) { return new HttpNetworkSession(session_deps->host_resolver.get(), NULL /* dnsrr_resolver */, - NULL /* ssl_host_info_factory */, session_deps->proxy_service, &session_deps->socket_factory, session_deps->ssl_config_service, @@ -297,7 +296,7 @@ template<> CaptureGroupNameSSLSocketPool::CaptureGroupNameSocketPool( HttpNetworkSession* session) : SSLClientSocketPool(0, 0, NULL, session->host_resolver(), NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL) {} + NULL, NULL, NULL, NULL, NULL) {} //----------------------------------------------------------------------------- @@ -6425,8 +6424,8 @@ TEST_F(HttpNetworkTransactionTest, SSLConfig ssl_config; session->ssl_config_service()->GetSSLConfig(&ssl_config); ClientSocket* socket = connection->release_socket(); - socket = session->socket_factory()->CreateSSLClientSocket( - socket, "" , ssl_config, NULL /* ssl_host_info */); + socket = session->socket_factory()->CreateSSLClientSocket(socket, "" , + ssl_config); connection->set_socket(socket); EXPECT_EQ(ERR_IO_PENDING, socket->Connect(&callback)); EXPECT_EQ(OK, callback.WaitForResult()); diff --git a/net/http/http_proxy_client_socket_pool_unittest.cc b/net/http/http_proxy_client_socket_pool_unittest.cc index e1ca2fe..71485e9 100644 --- a/net/http/http_proxy_client_socket_pool_unittest.cc +++ b/net/http/http_proxy_client_socket_pool_unittest.cc @@ -66,7 +66,6 @@ class HttpProxyClientSocketPoolTest : public TestWithHttpParam { &ssl_histograms_, host_resolver_.get(), NULL /* dnsrr_resolver */, - NULL /* ssl_host_info_factory */, &socket_factory_, &tcp_socket_pool_, NULL, @@ -77,7 +76,6 @@ class HttpProxyClientSocketPoolTest : public TestWithHttpParam { HttpAuthHandlerFactory::CreateDefault(host_resolver_.get())), session_(new HttpNetworkSession(host_resolver_.get(), NULL /* dnsrr_resolver */, - NULL /* ssl_host_info_factory */, ProxyService::CreateDirect(), &socket_factory_, new SSLConfigServiceDefaults, diff --git a/net/http/http_response_body_drainer_unittest.cc b/net/http/http_response_body_drainer_unittest.cc index d57952d..119d8f7 100644 --- a/net/http/http_response_body_drainer_unittest.cc +++ b/net/http/http_response_body_drainer_unittest.cc @@ -177,7 +177,6 @@ class HttpResponseBodyDrainerTest : public testing::Test { : session_(new HttpNetworkSession( NULL, NULL, - NULL /* ssl_host_info_factory */, ProxyService::CreateDirect(), NULL, new SSLConfigServiceDefaults, |