blob: 610308482b185982f7fe712b298b5be5fa8cb89e [file] [log] [blame]
[email protected]e34400c32012-01-24 02:49:331// Copyright (c) 2012 The Chromium Authors. All rights reserved.
[email protected]e60e47a2010-07-14 03:37:182// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "net/socket/ssl_client_socket_pool.h"
6
[email protected]6ecf2b92011-12-15 01:14:527#include "base/bind.h"
8#include "base/bind_helpers.h"
[email protected]c63248d42011-02-18 17:54:399#include "base/metrics/field_trial.h"
[email protected]835d7c82010-10-14 04:38:3810#include "base/metrics/histogram.h"
[email protected]92a31242013-06-28 18:08:0811#include "base/metrics/sparse_histogram.h"
[email protected]8e458552014-08-05 00:02:1512#include "base/stl_util.h"
[email protected]ba00b492010-09-08 14:53:3813#include "base/values.h"
[email protected]4f4de7e62010-11-12 19:55:2714#include "net/base/host_port_pair.h"
[email protected]536fd0b2013-03-14 17:41:5715#include "net/base/net_errors.h"
[email protected]33b511c2010-08-11 00:04:4316#include "net/http/http_proxy_client_socket.h"
17#include "net/http/http_proxy_client_socket_pool.h"
[email protected]e60e47a2010-07-14 03:37:1818#include "net/socket/client_socket_factory.h"
19#include "net/socket/client_socket_handle.h"
[email protected]33b511c2010-08-11 00:04:4320#include "net/socket/socks_client_socket_pool.h"
21#include "net/socket/ssl_client_socket.h"
[email protected]ab739042011-04-07 15:22:2822#include "net/socket/transport_client_socket_pool.h"
[email protected]536fd0b2013-03-14 17:41:5723#include "net/ssl/ssl_cert_request_info.h"
[email protected]92a31242013-06-28 18:08:0824#include "net/ssl/ssl_connection_status_flags.h"
25#include "net/ssl/ssl_info.h"
[email protected]e60e47a2010-07-14 03:37:1826
27namespace net {
28
29SSLSocketParams::SSLSocketParams(
[email protected]ea79ba92013-08-15 21:56:2030 const scoped_refptr<TransportSocketParams>& direct_params,
31 const scoped_refptr<SOCKSSocketParams>& socks_proxy_params,
[email protected]2431756e2010-09-29 20:26:1332 const scoped_refptr<HttpProxySocketParams>& http_proxy_params,
[email protected]4f4de7e62010-11-12 19:55:2733 const HostPortPair& host_and_port,
[email protected]e60e47a2010-07-14 03:37:1834 const SSLConfig& ssl_config,
[email protected]5e5021a2013-07-17 05:23:3635 PrivacyMode privacy_mode,
[email protected]e60e47a2010-07-14 03:37:1836 int load_flags,
[email protected]9e9e842e2010-07-23 23:09:1537 bool force_spdy_over_ssl,
38 bool want_spdy_over_npn)
[email protected]ea79ba92013-08-15 21:56:2039 : direct_params_(direct_params),
40 socks_proxy_params_(socks_proxy_params),
[email protected]e60e47a2010-07-14 03:37:1841 http_proxy_params_(http_proxy_params),
[email protected]4f4de7e62010-11-12 19:55:2742 host_and_port_(host_and_port),
[email protected]e60e47a2010-07-14 03:37:1843 ssl_config_(ssl_config),
[email protected]5e5021a2013-07-17 05:23:3644 privacy_mode_(privacy_mode),
[email protected]e60e47a2010-07-14 03:37:1845 load_flags_(load_flags),
[email protected]9e9e842e2010-07-23 23:09:1546 force_spdy_over_ssl_(force_spdy_over_ssl),
[email protected]0e14e87d2011-06-21 21:24:1947 want_spdy_over_npn_(want_spdy_over_npn),
48 ignore_limits_(false) {
[email protected]ea79ba92013-08-15 21:56:2049 if (direct_params_) {
50 DCHECK(!socks_proxy_params_);
51 DCHECK(!http_proxy_params_);
52 ignore_limits_ = direct_params_->ignore_limits();
53 } else if (socks_proxy_params_) {
54 DCHECK(!http_proxy_params_);
55 ignore_limits_ = socks_proxy_params_->ignore_limits();
56 } else {
57 DCHECK(http_proxy_params_);
58 ignore_limits_ = http_proxy_params_->ignore_limits();
[email protected]e60e47a2010-07-14 03:37:1859 }
60}
61
62SSLSocketParams::~SSLSocketParams() {}
63
[email protected]ea79ba92013-08-15 21:56:2064SSLSocketParams::ConnectionType SSLSocketParams::GetConnectionType() const {
65 if (direct_params_) {
66 DCHECK(!socks_proxy_params_);
67 DCHECK(!http_proxy_params_);
68 return DIRECT;
69 }
70
71 if (socks_proxy_params_) {
72 DCHECK(!http_proxy_params_);
73 return SOCKS_PROXY;
74 }
75
76 DCHECK(http_proxy_params_);
77 return HTTP_PROXY;
78}
79
80const scoped_refptr<TransportSocketParams>&
81SSLSocketParams::GetDirectConnectionParams() const {
82 DCHECK_EQ(GetConnectionType(), DIRECT);
83 return direct_params_;
84}
85
86const scoped_refptr<SOCKSSocketParams>&
87SSLSocketParams::GetSocksProxyConnectionParams() const {
88 DCHECK_EQ(GetConnectionType(), SOCKS_PROXY);
89 return socks_proxy_params_;
90}
91
92const scoped_refptr<HttpProxySocketParams>&
93SSLSocketParams::GetHttpProxyConnectionParams() const {
94 DCHECK_EQ(GetConnectionType(), HTTP_PROXY);
95 return http_proxy_params_;
96}
97
[email protected]8e458552014-08-05 00:02:1598SSLConnectJobMessenger::SocketAndCallback::SocketAndCallback(
99 SSLClientSocket* ssl_socket,
100 const base::Closure& job_resumption_callback)
101 : socket(ssl_socket), callback(job_resumption_callback) {
102}
103
104SSLConnectJobMessenger::SocketAndCallback::~SocketAndCallback() {
105}
106
[email protected]cffd7f92014-08-21 21:30:50107SSLConnectJobMessenger::SSLConnectJobMessenger(
108 const base::Closure& messenger_finished_callback)
109 : messenger_finished_callback_(messenger_finished_callback),
110 weak_factory_(this) {
[email protected]8e458552014-08-05 00:02:15111}
112
113SSLConnectJobMessenger::~SSLConnectJobMessenger() {
114}
115
116void SSLConnectJobMessenger::RemovePendingSocket(SSLClientSocket* ssl_socket) {
117 // Sockets do not need to be removed from connecting_sockets_ because
118 // OnSSLHandshakeCompleted will do this.
119 for (SSLPendingSocketsAndCallbacks::iterator it =
120 pending_sockets_and_callbacks_.begin();
121 it != pending_sockets_and_callbacks_.end();
122 ++it) {
123 if (it->socket == ssl_socket) {
124 pending_sockets_and_callbacks_.erase(it);
125 return;
126 }
127 }
128}
129
130bool SSLConnectJobMessenger::CanProceed(SSLClientSocket* ssl_socket) {
[email protected]cffd7f92014-08-21 21:30:50131 // If there are no connecting sockets, allow the connection to proceed.
132 return connecting_sockets_.empty();
[email protected]8e458552014-08-05 00:02:15133}
134
135void SSLConnectJobMessenger::MonitorConnectionResult(
136 SSLClientSocket* ssl_socket) {
137 connecting_sockets_.push_back(ssl_socket);
138 ssl_socket->SetHandshakeCompletionCallback(
139 base::Bind(&SSLConnectJobMessenger::OnSSLHandshakeCompleted,
140 weak_factory_.GetWeakPtr()));
141}
142
143void SSLConnectJobMessenger::AddPendingSocket(SSLClientSocket* ssl_socket,
144 const base::Closure& callback) {
145 DCHECK(!connecting_sockets_.empty());
146 pending_sockets_and_callbacks_.push_back(
147 SocketAndCallback(ssl_socket, callback));
148}
149
150void SSLConnectJobMessenger::OnSSLHandshakeCompleted() {
151 connecting_sockets_.clear();
152 SSLPendingSocketsAndCallbacks temp_list;
153 temp_list.swap(pending_sockets_and_callbacks_);
[email protected]cffd7f92014-08-21 21:30:50154 base::Closure messenger_finished_callback = messenger_finished_callback_;
155 messenger_finished_callback.Run();
[email protected]8e458552014-08-05 00:02:15156 RunAllCallbacks(temp_list);
157}
158
159void SSLConnectJobMessenger::RunAllCallbacks(
160 const SSLPendingSocketsAndCallbacks& pending_sockets_and_callbacks) {
161 for (std::vector<SocketAndCallback>::const_iterator it =
162 pending_sockets_and_callbacks.begin();
163 it != pending_sockets_and_callbacks.end();
164 ++it) {
165 it->callback.Run();
166 }
167}
168
[email protected]e60e47a2010-07-14 03:37:18169// Timeout for the SSL handshake portion of the connect.
170static const int kSSLHandshakeTimeoutInSeconds = 30;
171
[email protected]feb79bcd2011-07-21 16:55:17172SSLConnectJob::SSLConnectJob(const std::string& group_name,
[email protected]3f6007ab2013-08-22 19:45:39173 RequestPriority priority,
[email protected]feb79bcd2011-07-21 16:55:17174 const scoped_refptr<SSLSocketParams>& params,
175 const base::TimeDelta& timeout_duration,
176 TransportClientSocketPool* transport_pool,
177 SOCKSClientSocketPool* socks_pool,
178 HttpProxyClientSocketPool* http_proxy_pool,
179 ClientSocketFactory* client_socket_factory,
180 HostResolver* host_resolver,
181 const SSLClientSocketContext& context,
[email protected]cffd7f92014-08-21 21:30:50182 const GetMessengerCallback& get_messenger_callback,
[email protected]feb79bcd2011-07-21 16:55:17183 Delegate* delegate,
184 NetLog* net_log)
[email protected]5e5021a2013-07-17 05:23:36185 : ConnectJob(group_name,
186 timeout_duration,
[email protected]3f6007ab2013-08-22 19:45:39187 priority,
[email protected]5e5021a2013-07-17 05:23:36188 delegate,
[email protected]e60e47a2010-07-14 03:37:18189 BoundNetLog::Make(net_log, NetLog::SOURCE_CONNECT_JOB)),
190 params_(params),
[email protected]ab739042011-04-07 15:22:28191 transport_pool_(transport_pool),
[email protected]e60e47a2010-07-14 03:37:18192 socks_pool_(socks_pool),
[email protected]2431756e2010-09-29 20:26:13193 http_proxy_pool_(http_proxy_pool),
[email protected]e60e47a2010-07-14 03:37:18194 client_socket_factory_(client_socket_factory),
[email protected]822581d2010-12-16 17:27:15195 host_resolver_(host_resolver),
[email protected]5e5021a2013-07-17 05:23:36196 context_(context.cert_verifier,
[email protected]6b8a3c742014-07-25 00:25:35197 context.channel_id_service,
[email protected]5e5021a2013-07-17 05:23:36198 context.transport_security_state,
[email protected]284303b62013-11-28 15:11:54199 context.cert_transparency_verifier,
[email protected]314b03992014-04-01 01:28:53200 (params->privacy_mode() == PRIVACY_MODE_ENABLED
[email protected]5e5021a2013-07-17 05:23:36201 ? "pm/" + context.ssl_session_cache_shard
202 : context.ssl_session_cache_shard)),
[email protected]8e458552014-08-05 00:02:15203 io_callback_(
204 base::Bind(&SSLConnectJob::OnIOComplete, base::Unretained(this))),
[email protected]cffd7f92014-08-21 21:30:50205 messenger_(NULL),
206 get_messenger_callback_(get_messenger_callback),
[email protected]8e458552014-08-05 00:02:15207 weak_factory_(this) {
208}
[email protected]e60e47a2010-07-14 03:37:18209
[email protected]8e458552014-08-05 00:02:15210SSLConnectJob::~SSLConnectJob() {
211 if (ssl_socket_.get() && messenger_)
212 messenger_->RemovePendingSocket(ssl_socket_.get());
213}
[email protected]e60e47a2010-07-14 03:37:18214
215LoadState SSLConnectJob::GetLoadState() const {
216 switch (next_state_) {
[email protected]135e2262010-07-17 00:32:04217 case STATE_TUNNEL_CONNECT_COMPLETE:
218 if (transport_socket_handle_->socket())
219 return LOAD_STATE_ESTABLISHING_PROXY_TUNNEL;
220 // else, fall through.
[email protected]ab739042011-04-07 15:22:28221 case STATE_TRANSPORT_CONNECT:
222 case STATE_TRANSPORT_CONNECT_COMPLETE:
[email protected]e60e47a2010-07-14 03:37:18223 case STATE_SOCKS_CONNECT:
224 case STATE_SOCKS_CONNECT_COMPLETE:
225 case STATE_TUNNEL_CONNECT:
[email protected]e60e47a2010-07-14 03:37:18226 return transport_socket_handle_->GetLoadState();
[email protected]8e458552014-08-05 00:02:15227 case STATE_CREATE_SSL_SOCKET:
228 case STATE_CHECK_FOR_RESUME:
[email protected]e60e47a2010-07-14 03:37:18229 case STATE_SSL_CONNECT:
230 case STATE_SSL_CONNECT_COMPLETE:
231 return LOAD_STATE_SSL_HANDSHAKE;
232 default:
233 NOTREACHED();
234 return LOAD_STATE_IDLE;
235 }
236}
237
[email protected]83039bb2011-12-09 18:43:55238void SSLConnectJob::GetAdditionalErrorState(ClientSocketHandle* handle) {
[email protected]ad74a592011-01-21 18:40:55239 // Headers in |error_response_info_| indicate a proxy tunnel setup
240 // problem. See DoTunnelConnectComplete.
[email protected]90499482013-06-01 00:39:50241 if (error_response_info_.headers.get()) {
[email protected]ad74a592011-01-21 18:40:55242 handle->set_pending_http_proxy_connection(
243 transport_socket_handle_.release());
[email protected]e60e47a2010-07-14 03:37:18244 }
[email protected]ad74a592011-01-21 18:40:55245 handle->set_ssl_error_response_info(error_response_info_);
[email protected]034df0f32013-01-07 23:17:48246 if (!connect_timing_.ssl_start.is_null())
[email protected]ad74a592011-01-21 18:40:55247 handle->set_is_ssl_error(true);
[email protected]e60e47a2010-07-14 03:37:18248}
249
250void SSLConnectJob::OnIOComplete(int result) {
251 int rv = DoLoop(result);
252 if (rv != ERR_IO_PENDING)
253 NotifyDelegateOfCompletion(rv); // Deletes |this|.
254}
255
256int SSLConnectJob::DoLoop(int result) {
257 DCHECK_NE(next_state_, STATE_NONE);
258
259 int rv = result;
260 do {
261 State state = next_state_;
262 next_state_ = STATE_NONE;
263 switch (state) {
[email protected]ab739042011-04-07 15:22:28264 case STATE_TRANSPORT_CONNECT:
[email protected]e60e47a2010-07-14 03:37:18265 DCHECK_EQ(OK, rv);
[email protected]ab739042011-04-07 15:22:28266 rv = DoTransportConnect();
[email protected]e60e47a2010-07-14 03:37:18267 break;
[email protected]ab739042011-04-07 15:22:28268 case STATE_TRANSPORT_CONNECT_COMPLETE:
269 rv = DoTransportConnectComplete(rv);
[email protected]e60e47a2010-07-14 03:37:18270 break;
271 case STATE_SOCKS_CONNECT:
272 DCHECK_EQ(OK, rv);
273 rv = DoSOCKSConnect();
274 break;
275 case STATE_SOCKS_CONNECT_COMPLETE:
276 rv = DoSOCKSConnectComplete(rv);
277 break;
278 case STATE_TUNNEL_CONNECT:
279 DCHECK_EQ(OK, rv);
280 rv = DoTunnelConnect();
281 break;
282 case STATE_TUNNEL_CONNECT_COMPLETE:
283 rv = DoTunnelConnectComplete(rv);
284 break;
[email protected]8e458552014-08-05 00:02:15285 case STATE_CREATE_SSL_SOCKET:
286 rv = DoCreateSSLSocket();
287 break;
288 case STATE_CHECK_FOR_RESUME:
289 rv = DoCheckForResume();
290 break;
[email protected]e60e47a2010-07-14 03:37:18291 case STATE_SSL_CONNECT:
292 DCHECK_EQ(OK, rv);
293 rv = DoSSLConnect();
294 break;
295 case STATE_SSL_CONNECT_COMPLETE:
296 rv = DoSSLConnectComplete(rv);
297 break;
298 default:
299 NOTREACHED() << "bad state";
300 rv = ERR_FAILED;
301 break;
302 }
303 } while (rv != ERR_IO_PENDING && next_state_ != STATE_NONE);
304
305 return rv;
306}
307
[email protected]ab739042011-04-07 15:22:28308int SSLConnectJob::DoTransportConnect() {
309 DCHECK(transport_pool_);
[email protected]899c3e92010-08-28 15:53:50310
[email protected]ab739042011-04-07 15:22:28311 next_state_ = STATE_TRANSPORT_CONNECT_COMPLETE;
[email protected]e60e47a2010-07-14 03:37:18312 transport_socket_handle_.reset(new ClientSocketHandle());
[email protected]ea79ba92013-08-15 21:56:20313 scoped_refptr<TransportSocketParams> direct_params =
314 params_->GetDirectConnectionParams();
[email protected]5109c1952013-08-20 18:44:10315 return transport_socket_handle_->Init(group_name(),
316 direct_params,
[email protected]3f6007ab2013-08-22 19:45:39317 priority(),
[email protected]8e458552014-08-05 00:02:15318 io_callback_,
[email protected]5109c1952013-08-20 18:44:10319 transport_pool_,
320 net_log());
[email protected]e60e47a2010-07-14 03:37:18321}
322
[email protected]ab739042011-04-07 15:22:28323int SSLConnectJob::DoTransportConnectComplete(int result) {
[email protected]e60e47a2010-07-14 03:37:18324 if (result == OK)
[email protected]8e458552014-08-05 00:02:15325 next_state_ = STATE_CREATE_SSL_SOCKET;
[email protected]e60e47a2010-07-14 03:37:18326
327 return result;
328}
329
330int SSLConnectJob::DoSOCKSConnect() {
[email protected]2431756e2010-09-29 20:26:13331 DCHECK(socks_pool_);
[email protected]e60e47a2010-07-14 03:37:18332 next_state_ = STATE_SOCKS_CONNECT_COMPLETE;
333 transport_socket_handle_.reset(new ClientSocketHandle());
[email protected]ea79ba92013-08-15 21:56:20334 scoped_refptr<SOCKSSocketParams> socks_proxy_params =
335 params_->GetSocksProxyConnectionParams();
[email protected]5109c1952013-08-20 18:44:10336 return transport_socket_handle_->Init(group_name(),
337 socks_proxy_params,
[email protected]3f6007ab2013-08-22 19:45:39338 priority(),
[email protected]8e458552014-08-05 00:02:15339 io_callback_,
[email protected]5109c1952013-08-20 18:44:10340 socks_pool_,
341 net_log());
[email protected]e60e47a2010-07-14 03:37:18342}
343
344int SSLConnectJob::DoSOCKSConnectComplete(int result) {
345 if (result == OK)
[email protected]8e458552014-08-05 00:02:15346 next_state_ = STATE_CREATE_SSL_SOCKET;
[email protected]e60e47a2010-07-14 03:37:18347
348 return result;
349}
350
351int SSLConnectJob::DoTunnelConnect() {
[email protected]2431756e2010-09-29 20:26:13352 DCHECK(http_proxy_pool_);
[email protected]e60e47a2010-07-14 03:37:18353 next_state_ = STATE_TUNNEL_CONNECT_COMPLETE;
[email protected]394816e92010-08-03 07:38:59354
[email protected]e60e47a2010-07-14 03:37:18355 transport_socket_handle_.reset(new ClientSocketHandle());
356 scoped_refptr<HttpProxySocketParams> http_proxy_params =
[email protected]ea79ba92013-08-15 21:56:20357 params_->GetHttpProxyConnectionParams();
[email protected]5109c1952013-08-20 18:44:10358 return transport_socket_handle_->Init(group_name(),
359 http_proxy_params,
[email protected]3f6007ab2013-08-22 19:45:39360 priority(),
[email protected]8e458552014-08-05 00:02:15361 io_callback_,
[email protected]5109c1952013-08-20 18:44:10362 http_proxy_pool_,
363 net_log());
[email protected]e60e47a2010-07-14 03:37:18364}
365
366int SSLConnectJob::DoTunnelConnectComplete(int result) {
[email protected]4f4de7e62010-11-12 19:55:27367 // Extract the information needed to prompt for appropriate proxy
368 // authentication so that when ClientSocketPoolBaseHelper calls
369 // |GetAdditionalErrorState|, we can easily set the state.
370 if (result == ERR_SSL_CLIENT_AUTH_CERT_NEEDED) {
371 error_response_info_ = transport_socket_handle_->ssl_error_response_info();
[email protected]511f6f52010-12-17 03:58:29372 } else if (result == ERR_PROXY_AUTH_REQUESTED ||
373 result == ERR_HTTPS_PROXY_TUNNEL_RESPONSE) {
[email protected]3268023f2011-05-05 00:08:10374 StreamSocket* socket = transport_socket_handle_->socket();
[email protected]fe3b7dc2012-02-03 19:52:09375 HttpProxyClientSocket* tunnel_socket =
376 static_cast<HttpProxyClientSocket*>(socket);
[email protected]511f6f52010-12-17 03:58:29377 error_response_info_ = *tunnel_socket->GetConnectResponseInfo();
[email protected]4f4de7e62010-11-12 19:55:27378 }
[email protected]e60e47a2010-07-14 03:37:18379 if (result < 0)
380 return result;
[email protected]8e458552014-08-05 00:02:15381 next_state_ = STATE_CREATE_SSL_SOCKET;
[email protected]e60e47a2010-07-14 03:37:18382 return result;
383}
384
[email protected]8e458552014-08-05 00:02:15385int SSLConnectJob::DoCreateSSLSocket() {
386 next_state_ = STATE_CHECK_FOR_RESUME;
387
[email protected]e60e47a2010-07-14 03:37:18388 // Reset the timeout to just the time allowed for the SSL handshake.
389 ResetTimer(base::TimeDelta::FromSeconds(kSSLHandshakeTimeoutInSeconds));
[email protected]034df0f32013-01-07 23:17:48390
391 // If the handle has a fresh socket, get its connect start and DNS times.
392 // This should always be the case.
393 const LoadTimingInfo::ConnectTiming& socket_connect_timing =
394 transport_socket_handle_->connect_timing();
395 if (!transport_socket_handle_->is_reused() &&
396 !socket_connect_timing.connect_start.is_null()) {
397 // Overwriting |connect_start| serves two purposes - it adjusts timing so
398 // |connect_start| doesn't include dns times, and it adjusts the time so
399 // as not to include time spent waiting for an idle socket.
400 connect_timing_.connect_start = socket_connect_timing.connect_start;
401 connect_timing_.dns_start = socket_connect_timing.dns_start;
402 connect_timing_.dns_end = socket_connect_timing.dns_end;
403 }
404
[email protected]18ccfdb2013-08-15 00:13:44405 ssl_socket_ = client_socket_factory_->CreateSSLClientSocket(
406 transport_socket_handle_.Pass(),
[email protected]5e5021a2013-07-17 05:23:36407 params_->host_and_port(),
408 params_->ssl_config(),
[email protected]18ccfdb2013-08-15 00:13:44409 context_);
[email protected]cffd7f92014-08-21 21:30:50410
411 if (!ssl_socket_->InSessionCache())
412 messenger_ = get_messenger_callback_.Run(ssl_socket_->GetSessionCacheKey());
413
[email protected]8e458552014-08-05 00:02:15414 return OK;
415}
416
417int SSLConnectJob::DoCheckForResume() {
418 next_state_ = STATE_SSL_CONNECT;
[email protected]cffd7f92014-08-21 21:30:50419
[email protected]8e458552014-08-05 00:02:15420 if (!messenger_)
421 return OK;
422
[email protected]8e458552014-08-05 00:02:15423 if (messenger_->CanProceed(ssl_socket_.get())) {
[email protected]cffd7f92014-08-21 21:30:50424 messenger_->MonitorConnectionResult(ssl_socket_.get());
425 // The SSLConnectJob no longer needs access to the messenger after this
426 // point.
427 messenger_ = NULL;
[email protected]8e458552014-08-05 00:02:15428 return OK;
429 }
[email protected]cffd7f92014-08-21 21:30:50430
[email protected]8e458552014-08-05 00:02:15431 messenger_->AddPendingSocket(ssl_socket_.get(),
432 base::Bind(&SSLConnectJob::ResumeSSLConnection,
433 weak_factory_.GetWeakPtr()));
[email protected]cffd7f92014-08-21 21:30:50434
[email protected]8e458552014-08-05 00:02:15435 return ERR_IO_PENDING;
436}
437
438int SSLConnectJob::DoSSLConnect() {
439 next_state_ = STATE_SSL_CONNECT_COMPLETE;
440
441 connect_timing_.ssl_start = base::TimeTicks::Now();
442
443 return ssl_socket_->Connect(io_callback_);
[email protected]e60e47a2010-07-14 03:37:18444}
445
446int SSLConnectJob::DoSSLConnectComplete(int result) {
[email protected]034df0f32013-01-07 23:17:48447 connect_timing_.ssl_end = base::TimeTicks::Now();
448
[email protected]e60e47a2010-07-14 03:37:18449 SSLClientSocket::NextProtoStatus status =
450 SSLClientSocket::kNextProtoUnsupported;
451 std::string proto;
452 // GetNextProto will fail and and trigger a NOTREACHED if we pass in a socket
453 // that hasn't had SSL_ImportFD called on it. If we get a certificate error
454 // here, then we know that we called SSL_ImportFD.
455 if (result == OK || IsCertificateError(result))
[email protected]abc44b752014-07-30 03:52:15456 status = ssl_socket_->GetNextProto(&proto);
[email protected]e60e47a2010-07-14 03:37:18457
[email protected]9e9e842e2010-07-23 23:09:15458 // If we want spdy over npn, make sure it succeeded.
[email protected]e60e47a2010-07-14 03:37:18459 if (status == SSLClientSocket::kNextProtoNegotiated) {
[email protected]d7c9f422010-08-27 22:54:53460 ssl_socket_->set_was_npn_negotiated(true);
[email protected]8e3c78cb2012-03-31 03:58:46461 NextProto protocol_negotiated =
[email protected]bace48c2010-08-03 20:52:02462 SSLClientSocket::NextProtoFromString(proto);
[email protected]c30bcce2011-12-20 17:50:51463 ssl_socket_->set_protocol_negotiated(protocol_negotiated);
[email protected]63bf9662013-03-05 20:46:01464 // If we negotiated a SPDY version, it must have been present in
465 // SSLConfig::next_protos.
466 // TODO(mbelshe): Verify this.
467 if (protocol_negotiated >= kProtoSPDYMinimumVersion &&
468 protocol_negotiated <= kProtoSPDYMaximumVersion) {
[email protected]d7c9f422010-08-27 22:54:53469 ssl_socket_->set_was_spdy_negotiated(true);
[email protected]e60e47a2010-07-14 03:37:18470 }
471 }
[email protected]d7c9f422010-08-27 22:54:53472 if (params_->want_spdy_over_npn() && !ssl_socket_->was_spdy_negotiated())
[email protected]e60e47a2010-07-14 03:37:18473 return ERR_NPN_NEGOTIATION_FAILED;
474
[email protected]9e9e842e2010-07-23 23:09:15475 // Spdy might be turned on by default, or it might be over npn.
476 bool using_spdy = params_->force_spdy_over_ssl() ||
477 params_->want_spdy_over_npn();
478
[email protected]e60e47a2010-07-14 03:37:18479 if (result == OK ||
480 ssl_socket_->IgnoreCertError(result, params_->load_flags())) {
[email protected]034df0f32013-01-07 23:17:48481 DCHECK(!connect_timing_.ssl_start.is_null());
[email protected]e60e47a2010-07-14 03:37:18482 base::TimeDelta connect_duration =
[email protected]034df0f32013-01-07 23:17:48483 connect_timing_.ssl_end - connect_timing_.ssl_start;
[email protected]835d7c82010-10-14 04:38:38484 if (using_spdy) {
[email protected]847276962013-03-08 23:53:17485 UMA_HISTOGRAM_CUSTOM_TIMES("Net.SpdyConnectionLatency_2",
[email protected]e60e47a2010-07-14 03:37:18486 connect_duration,
487 base::TimeDelta::FromMilliseconds(1),
[email protected]847276962013-03-08 23:53:17488 base::TimeDelta::FromMinutes(1),
[email protected]e60e47a2010-07-14 03:37:18489 100);
[email protected]f906bfe2011-06-09 16:35:24490 }
[email protected]17ed3b82013-07-12 19:21:26491#if defined(SPDY_PROXY_AUTH_ORIGIN)
492 bool using_data_reduction_proxy = params_->host_and_port().Equals(
493 HostPortPair::FromURL(GURL(SPDY_PROXY_AUTH_ORIGIN)));
494 if (using_data_reduction_proxy) {
495 UMA_HISTOGRAM_CUSTOM_TIMES(
496 "Net.SSL_Connection_Latency_DataReductionProxy",
497 connect_duration,
498 base::TimeDelta::FromMilliseconds(1),
499 base::TimeDelta::FromMinutes(1),
500 100);
501 }
502#endif
[email protected]f906bfe2011-06-09 16:35:24503
[email protected]847276962013-03-08 23:53:17504 UMA_HISTOGRAM_CUSTOM_TIMES("Net.SSL_Connection_Latency_2",
[email protected]f906bfe2011-06-09 16:35:24505 connect_duration,
506 base::TimeDelta::FromMilliseconds(1),
[email protected]847276962013-03-08 23:53:17507 base::TimeDelta::FromMinutes(1),
[email protected]f906bfe2011-06-09 16:35:24508 100);
509
[email protected]b076d6c2011-06-29 14:47:51510 SSLInfo ssl_info;
511 ssl_socket_->GetSSLInfo(&ssl_info);
512
[email protected]92a31242013-06-28 18:08:08513 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.SSL_CipherSuite",
514 SSLConnectionStatusToCipherSuite(
515 ssl_info.connection_status));
516
[email protected]b076d6c2011-06-29 14:47:51517 if (ssl_info.handshake_type == SSLInfo::HANDSHAKE_RESUME) {
518 UMA_HISTOGRAM_CUSTOM_TIMES("Net.SSL_Connection_Latency_Resume_Handshake",
519 connect_duration,
520 base::TimeDelta::FromMilliseconds(1),
521 base::TimeDelta::FromMinutes(1),
522 100);
523 } else if (ssl_info.handshake_type == SSLInfo::HANDSHAKE_FULL) {
524 UMA_HISTOGRAM_CUSTOM_TIMES("Net.SSL_Connection_Latency_Full_Handshake",
525 connect_duration,
526 base::TimeDelta::FromMilliseconds(1),
527 base::TimeDelta::FromMinutes(1),
528 100);
529 }
530
[email protected]f906bfe2011-06-09 16:35:24531 const std::string& host = params_->host_and_port().host();
[email protected]8e458552014-08-05 00:02:15532 bool is_google =
533 host == "google.com" ||
534 (host.size() > 11 && host.rfind(".google.com") == host.size() - 11);
[email protected]f906bfe2011-06-09 16:35:24535 if (is_google) {
[email protected]847276962013-03-08 23:53:17536 UMA_HISTOGRAM_CUSTOM_TIMES("Net.SSL_Connection_Latency_Google2",
[email protected]e60e47a2010-07-14 03:37:18537 connect_duration,
538 base::TimeDelta::FromMilliseconds(1),
[email protected]847276962013-03-08 23:53:17539 base::TimeDelta::FromMinutes(1),
[email protected]e60e47a2010-07-14 03:37:18540 100);
[email protected]b076d6c2011-06-29 14:47:51541 if (ssl_info.handshake_type == SSLInfo::HANDSHAKE_RESUME) {
542 UMA_HISTOGRAM_CUSTOM_TIMES("Net.SSL_Connection_Latency_Google_"
543 "Resume_Handshake",
544 connect_duration,
545 base::TimeDelta::FromMilliseconds(1),
546 base::TimeDelta::FromMinutes(1),
547 100);
548 } else if (ssl_info.handshake_type == SSLInfo::HANDSHAKE_FULL) {
549 UMA_HISTOGRAM_CUSTOM_TIMES("Net.SSL_Connection_Latency_Google_"
550 "Full_Handshake",
551 connect_duration,
552 base::TimeDelta::FromMilliseconds(1),
553 base::TimeDelta::FromMinutes(1),
554 100);
555 }
[email protected]835d7c82010-10-14 04:38:38556 }
[email protected]e60e47a2010-07-14 03:37:18557 }
[email protected]8b498692010-07-16 17:11:43558
559 if (result == OK || IsCertificateError(result)) {
[email protected]18ccfdb2013-08-15 00:13:44560 SetSocket(ssl_socket_.PassAs<StreamSocket>());
[email protected]8b498692010-07-16 17:11:43561 } else if (result == ERR_SSL_CLIENT_AUTH_CERT_NEEDED) {
562 error_response_info_.cert_request_info = new SSLCertRequestInfo;
[email protected]90499482013-06-01 00:39:50563 ssl_socket_->GetSSLCertRequestInfo(
564 error_response_info_.cert_request_info.get());
[email protected]8b498692010-07-16 17:11:43565 }
[email protected]e60e47a2010-07-14 03:37:18566
567 return result;
568}
569
[email protected]8e458552014-08-05 00:02:15570void SSLConnectJob::ResumeSSLConnection() {
571 DCHECK_EQ(next_state_, STATE_SSL_CONNECT);
[email protected]cffd7f92014-08-21 21:30:50572 messenger_ = NULL;
[email protected]8e458552014-08-05 00:02:15573 OnIOComplete(OK);
574}
575
[email protected]ea79ba92013-08-15 21:56:20576SSLConnectJob::State SSLConnectJob::GetInitialState(
577 SSLSocketParams::ConnectionType connection_type) {
578 switch (connection_type) {
579 case SSLSocketParams::DIRECT:
580 return STATE_TRANSPORT_CONNECT;
581 case SSLSocketParams::HTTP_PROXY:
582 return STATE_TUNNEL_CONNECT;
583 case SSLSocketParams::SOCKS_PROXY:
584 return STATE_SOCKS_CONNECT;
[email protected]ad74a592011-01-21 18:40:55585 }
[email protected]ea79ba92013-08-15 21:56:20586 NOTREACHED();
587 return STATE_NONE;
588}
589
590int SSLConnectJob::ConnectInternal() {
591 next_state_ = GetInitialState(params_->GetConnectionType());
[email protected]ad74a592011-01-21 18:40:55592 return DoLoop(OK);
[email protected]e60e47a2010-07-14 03:37:18593}
594
595SSLClientSocketPool::SSLConnectJobFactory::SSLConnectJobFactory(
[email protected]ab739042011-04-07 15:22:28596 TransportClientSocketPool* transport_pool,
[email protected]2431756e2010-09-29 20:26:13597 SOCKSClientSocketPool* socks_pool,
598 HttpProxyClientSocketPool* http_proxy_pool,
[email protected]e60e47a2010-07-14 03:37:18599 ClientSocketFactory* client_socket_factory,
600 HostResolver* host_resolver,
[email protected]feb79bcd2011-07-21 16:55:17601 const SSLClientSocketContext& context,
[email protected]cffd7f92014-08-21 21:30:50602 const SSLConnectJob::GetMessengerCallback& get_messenger_callback,
[email protected]e60e47a2010-07-14 03:37:18603 NetLog* net_log)
[email protected]ab739042011-04-07 15:22:28604 : transport_pool_(transport_pool),
[email protected]e60e47a2010-07-14 03:37:18605 socks_pool_(socks_pool),
[email protected]2431756e2010-09-29 20:26:13606 http_proxy_pool_(http_proxy_pool),
[email protected]e60e47a2010-07-14 03:37:18607 client_socket_factory_(client_socket_factory),
608 host_resolver_(host_resolver),
[email protected]feb79bcd2011-07-21 16:55:17609 context_(context),
[email protected]cffd7f92014-08-21 21:30:50610 get_messenger_callback_(get_messenger_callback),
611 net_log_(net_log) {
[email protected]e60e47a2010-07-14 03:37:18612 base::TimeDelta max_transport_timeout = base::TimeDelta();
613 base::TimeDelta pool_timeout;
[email protected]ab739042011-04-07 15:22:28614 if (transport_pool_)
615 max_transport_timeout = transport_pool_->ConnectionTimeout();
[email protected]e60e47a2010-07-14 03:37:18616 if (socks_pool_) {
617 pool_timeout = socks_pool_->ConnectionTimeout();
618 if (pool_timeout > max_transport_timeout)
619 max_transport_timeout = pool_timeout;
620 }
621 if (http_proxy_pool_) {
622 pool_timeout = http_proxy_pool_->ConnectionTimeout();
623 if (pool_timeout > max_transport_timeout)
624 max_transport_timeout = pool_timeout;
625 }
626 timeout_ = max_transport_timeout +
627 base::TimeDelta::FromSeconds(kSSLHandshakeTimeoutInSeconds);
628}
629
[email protected]8e458552014-08-05 00:02:15630SSLClientSocketPool::SSLConnectJobFactory::~SSLConnectJobFactory() {
[email protected]8e458552014-08-05 00:02:15631}
632
[email protected]e60e47a2010-07-14 03:37:18633SSLClientSocketPool::SSLClientSocketPool(
634 int max_sockets,
635 int max_sockets_per_group,
[email protected]2431756e2010-09-29 20:26:13636 ClientSocketPoolHistograms* histograms,
[email protected]73c45322010-10-01 23:57:54637 HostResolver* host_resolver,
[email protected]822581d2010-12-16 17:27:15638 CertVerifier* cert_verifier,
[email protected]6b8a3c742014-07-25 00:25:35639 ChannelIDService* channel_id_service,
[email protected]a2a41972011-12-07 17:47:27640 TransportSecurityState* transport_security_state,
[email protected]284303b62013-11-28 15:11:54641 CTVerifier* cert_transparency_verifier,
[email protected]c3456bb2011-12-12 22:22:19642 const std::string& ssl_session_cache_shard,
[email protected]e60e47a2010-07-14 03:37:18643 ClientSocketFactory* client_socket_factory,
[email protected]ab739042011-04-07 15:22:28644 TransportClientSocketPool* transport_pool,
[email protected]2431756e2010-09-29 20:26:13645 SOCKSClientSocketPool* socks_pool,
646 HttpProxyClientSocketPool* http_proxy_pool,
[email protected]7abf7d22010-09-04 01:41:59647 SSLConfigService* ssl_config_service,
[email protected]8e458552014-08-05 00:02:15648 bool enable_ssl_connect_job_waiting,
[email protected]e60e47a2010-07-14 03:37:18649 NetLog* net_log)
[email protected]ab739042011-04-07 15:22:28650 : transport_pool_(transport_pool),
[email protected]ba00b492010-09-08 14:53:38651 socks_pool_(socks_pool),
[email protected]2431756e2010-09-29 20:26:13652 http_proxy_pool_(http_proxy_pool),
[email protected]8e458552014-08-05 00:02:15653 base_(this,
654 max_sockets,
655 max_sockets_per_group,
656 histograms,
[email protected]82b8c962011-10-12 09:17:30657 ClientSocketPool::unused_idle_socket_timeout(),
658 ClientSocketPool::used_idle_socket_timeout(),
[email protected]8e458552014-08-05 00:02:15659 new SSLConnectJobFactory(
660 transport_pool,
661 socks_pool,
662 http_proxy_pool,
663 client_socket_factory,
664 host_resolver,
665 SSLClientSocketContext(cert_verifier,
666 channel_id_service,
667 transport_security_state,
668 cert_transparency_verifier,
669 ssl_session_cache_shard),
[email protected]cffd7f92014-08-21 21:30:50670 base::Bind(
671 &SSLClientSocketPool::GetOrCreateSSLConnectJobMessenger,
672 base::Unretained(this)),
[email protected]8e458552014-08-05 00:02:15673 net_log)),
[email protected]cffd7f92014-08-21 21:30:50674 ssl_config_service_(ssl_config_service),
675 enable_ssl_connect_job_waiting_(enable_ssl_connect_job_waiting) {
[email protected]90499482013-06-01 00:39:50676 if (ssl_config_service_.get())
[email protected]7abf7d22010-09-04 01:41:59677 ssl_config_service_->AddObserver(this);
[email protected]51fdc7c2012-04-10 19:19:48678 if (transport_pool_)
[email protected]043b68c82013-08-22 23:41:52679 base_.AddLowerLayeredPool(transport_pool_);
[email protected]51fdc7c2012-04-10 19:19:48680 if (socks_pool_)
[email protected]043b68c82013-08-22 23:41:52681 base_.AddLowerLayeredPool(socks_pool_);
[email protected]51fdc7c2012-04-10 19:19:48682 if (http_proxy_pool_)
[email protected]043b68c82013-08-22 23:41:52683 base_.AddLowerLayeredPool(http_proxy_pool_);
[email protected]7abf7d22010-09-04 01:41:59684}
[email protected]e60e47a2010-07-14 03:37:18685
[email protected]7abf7d22010-09-04 01:41:59686SSLClientSocketPool::~SSLClientSocketPool() {
[email protected]cffd7f92014-08-21 21:30:50687 STLDeleteContainerPairSecondPointers(messenger_map_.begin(),
688 messenger_map_.end());
[email protected]90499482013-06-01 00:39:50689 if (ssl_config_service_.get())
[email protected]7abf7d22010-09-04 01:41:59690 ssl_config_service_->RemoveObserver(this);
691}
[email protected]e60e47a2010-07-14 03:37:18692
[email protected]cffd7f92014-08-21 21:30:50693scoped_ptr<ConnectJob> SSLClientSocketPool::SSLConnectJobFactory::NewConnectJob(
[email protected]ad74a592011-01-21 18:40:55694 const std::string& group_name,
695 const PoolBase::Request& request,
696 ConnectJob::Delegate* delegate) const {
[email protected]8e458552014-08-05 00:02:15697 return scoped_ptr<ConnectJob>(new SSLConnectJob(group_name,
698 request.priority(),
699 request.params(),
700 ConnectionTimeout(),
701 transport_pool_,
702 socks_pool_,
703 http_proxy_pool_,
704 client_socket_factory_,
705 host_resolver_,
706 context_,
[email protected]cffd7f92014-08-21 21:30:50707 get_messenger_callback_,
[email protected]8e458552014-08-05 00:02:15708 delegate,
709 net_log_));
[email protected]ad74a592011-01-21 18:40:55710}
711
[email protected]cffd7f92014-08-21 21:30:50712base::TimeDelta SSLClientSocketPool::SSLConnectJobFactory::ConnectionTimeout()
713 const {
[email protected]2a848e0e2012-08-09 22:27:31714 return timeout_;
715}
716
[email protected]e60e47a2010-07-14 03:37:18717int SSLClientSocketPool::RequestSocket(const std::string& group_name,
718 const void* socket_params,
719 RequestPriority priority,
720 ClientSocketHandle* handle,
[email protected]49639fa2011-12-20 23:22:41721 const CompletionCallback& callback,
[email protected]e60e47a2010-07-14 03:37:18722 const BoundNetLog& net_log) {
723 const scoped_refptr<SSLSocketParams>* casted_socket_params =
724 static_cast<const scoped_refptr<SSLSocketParams>*>(socket_params);
725
726 return base_.RequestSocket(group_name, *casted_socket_params, priority,
727 handle, callback, net_log);
728}
729
[email protected]2c2bef152010-10-13 00:55:03730void SSLClientSocketPool::RequestSockets(
731 const std::string& group_name,
732 const void* params,
733 int num_sockets,
734 const BoundNetLog& net_log) {
735 const scoped_refptr<SSLSocketParams>* casted_params =
736 static_cast<const scoped_refptr<SSLSocketParams>*>(params);
737
738 base_.RequestSockets(group_name, *casted_params, num_sockets, net_log);
739}
740
[email protected]e60e47a2010-07-14 03:37:18741void SSLClientSocketPool::CancelRequest(const std::string& group_name,
[email protected]05ea9ff2010-07-15 19:08:21742 ClientSocketHandle* handle) {
[email protected]e60e47a2010-07-14 03:37:18743 base_.CancelRequest(group_name, handle);
744}
745
746void SSLClientSocketPool::ReleaseSocket(const std::string& group_name,
[email protected]18ccfdb2013-08-15 00:13:44747 scoped_ptr<StreamSocket> socket,
748 int id) {
749 base_.ReleaseSocket(group_name, socket.Pass(), id);
[email protected]e60e47a2010-07-14 03:37:18750}
751
[email protected]7af985a2012-12-14 22:40:42752void SSLClientSocketPool::FlushWithError(int error) {
753 base_.FlushWithError(error);
[email protected]e60e47a2010-07-14 03:37:18754}
755
756void SSLClientSocketPool::CloseIdleSockets() {
757 base_.CloseIdleSockets();
758}
759
[email protected]ddb1e5a2010-12-13 20:10:45760int SSLClientSocketPool::IdleSocketCount() const {
761 return base_.idle_socket_count();
762}
763
[email protected]e60e47a2010-07-14 03:37:18764int SSLClientSocketPool::IdleSocketCountInGroup(
765 const std::string& group_name) const {
766 return base_.IdleSocketCountInGroup(group_name);
767}
768
769LoadState SSLClientSocketPool::GetLoadState(
770 const std::string& group_name, const ClientSocketHandle* handle) const {
771 return base_.GetLoadState(group_name, handle);
772}
773
[email protected]ea5ef4c2013-06-13 22:50:27774base::DictionaryValue* SSLClientSocketPool::GetInfoAsValue(
[email protected]ba00b492010-09-08 14:53:38775 const std::string& name,
776 const std::string& type,
777 bool include_nested_pools) const {
[email protected]ea5ef4c2013-06-13 22:50:27778 base::DictionaryValue* dict = base_.GetInfoAsValue(name, type);
[email protected]ba00b492010-09-08 14:53:38779 if (include_nested_pools) {
[email protected]ea5ef4c2013-06-13 22:50:27780 base::ListValue* list = new base::ListValue();
[email protected]ab739042011-04-07 15:22:28781 if (transport_pool_) {
782 list->Append(transport_pool_->GetInfoAsValue("transport_socket_pool",
783 "transport_socket_pool",
784 false));
[email protected]ba00b492010-09-08 14:53:38785 }
[email protected]2431756e2010-09-29 20:26:13786 if (socks_pool_) {
[email protected]ba00b492010-09-08 14:53:38787 list->Append(socks_pool_->GetInfoAsValue("socks_pool",
788 "socks_pool",
789 true));
790 }
[email protected]2431756e2010-09-29 20:26:13791 if (http_proxy_pool_) {
792 list->Append(http_proxy_pool_->GetInfoAsValue("http_proxy_pool",
793 "http_proxy_pool",
794 true));
795 }
[email protected]ba00b492010-09-08 14:53:38796 dict->Set("nested_pools", list);
797 }
798 return dict;
799}
800
[email protected]ddb1e5a2010-12-13 20:10:45801base::TimeDelta SSLClientSocketPool::ConnectionTimeout() const {
802 return base_.ConnectionTimeout();
803}
804
805ClientSocketPoolHistograms* SSLClientSocketPool::histograms() const {
806 return base_.histograms();
807}
808
[email protected]043b68c82013-08-22 23:41:52809bool SSLClientSocketPool::IsStalled() const {
810 return base_.IsStalled();
811}
812
813void SSLClientSocketPool::AddHigherLayeredPool(HigherLayeredPool* higher_pool) {
814 base_.AddHigherLayeredPool(higher_pool);
815}
816
817void SSLClientSocketPool::RemoveHigherLayeredPool(
818 HigherLayeredPool* higher_pool) {
819 base_.RemoveHigherLayeredPool(higher_pool);
[email protected]ad74a592011-01-21 18:40:55820}
821
[email protected]51fdc7c2012-04-10 19:19:48822bool SSLClientSocketPool::CloseOneIdleConnection() {
823 if (base_.CloseOneIdleSocket())
824 return true;
[email protected]043b68c82013-08-22 23:41:52825 return base_.CloseOneIdleConnectionInHigherLayeredPool();
826}
827
[email protected]cffd7f92014-08-21 21:30:50828SSLConnectJobMessenger* SSLClientSocketPool::GetOrCreateSSLConnectJobMessenger(
829 const std::string& cache_key) {
830 if (!enable_ssl_connect_job_waiting_)
831 return NULL;
832 MessengerMap::const_iterator it = messenger_map_.find(cache_key);
833 if (it == messenger_map_.end()) {
834 std::pair<MessengerMap::iterator, bool> iter =
835 messenger_map_.insert(MessengerMap::value_type(
836 cache_key,
837 new SSLConnectJobMessenger(
838 base::Bind(&SSLClientSocketPool::DeleteSSLConnectJobMessenger,
839 base::Unretained(this),
840 cache_key))));
841 it = iter.first;
842 }
843 return it->second;
844}
845
846void SSLClientSocketPool::DeleteSSLConnectJobMessenger(
847 const std::string& cache_key) {
848 MessengerMap::iterator it = messenger_map_.find(cache_key);
849 CHECK(it != messenger_map_.end());
850 delete it->second;
851 messenger_map_.erase(it);
852}
853
[email protected]043b68c82013-08-22 23:41:52854void SSLClientSocketPool::OnSSLConfigChanged() {
855 FlushWithError(ERR_NETWORK_CHANGED);
[email protected]51fdc7c2012-04-10 19:19:48856}
857
[email protected]e60e47a2010-07-14 03:37:18858} // namespace net