Material throbber: use in tabstrip
[chromium-blink-merge.git] / net / socket / ssl_client_socket_pool.cc
blob11de9193e579f51958af552bf40a31eee0204148
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "net/socket/ssl_client_socket_pool.h"
7 #include "base/bind.h"
8 #include "base/bind_helpers.h"
9 #include "base/metrics/field_trial.h"
10 #include "base/metrics/histogram.h"
11 #include "base/metrics/sparse_histogram.h"
12 #include "base/profiler/scoped_tracker.h"
13 #include "base/values.h"
14 #include "net/base/host_port_pair.h"
15 #include "net/base/net_errors.h"
16 #include "net/http/http_proxy_client_socket.h"
17 #include "net/http/http_proxy_client_socket_pool.h"
18 #include "net/socket/client_socket_factory.h"
19 #include "net/socket/client_socket_handle.h"
20 #include "net/socket/socks_client_socket_pool.h"
21 #include "net/socket/ssl_client_socket.h"
22 #include "net/socket/transport_client_socket_pool.h"
23 #include "net/ssl/ssl_cert_request_info.h"
24 #include "net/ssl/ssl_connection_status_flags.h"
25 #include "net/ssl/ssl_info.h"
27 namespace net {
29 SSLSocketParams::SSLSocketParams(
30 const scoped_refptr<TransportSocketParams>& direct_params,
31 const scoped_refptr<SOCKSSocketParams>& socks_proxy_params,
32 const scoped_refptr<HttpProxySocketParams>& http_proxy_params,
33 const HostPortPair& host_and_port,
34 const SSLConfig& ssl_config,
35 PrivacyMode privacy_mode,
36 int load_flags,
37 bool want_spdy_over_npn)
38 : direct_params_(direct_params),
39 socks_proxy_params_(socks_proxy_params),
40 http_proxy_params_(http_proxy_params),
41 host_and_port_(host_and_port),
42 ssl_config_(ssl_config),
43 privacy_mode_(privacy_mode),
44 load_flags_(load_flags),
45 want_spdy_over_npn_(want_spdy_over_npn),
46 ignore_limits_(false) {
47 if (direct_params_.get()) {
48 DCHECK(!socks_proxy_params_.get());
49 DCHECK(!http_proxy_params_.get());
50 ignore_limits_ = direct_params_->ignore_limits();
51 } else if (socks_proxy_params_.get()) {
52 DCHECK(!http_proxy_params_.get());
53 ignore_limits_ = socks_proxy_params_->ignore_limits();
54 } else {
55 DCHECK(http_proxy_params_.get());
56 ignore_limits_ = http_proxy_params_->ignore_limits();
60 SSLSocketParams::~SSLSocketParams() {}
62 SSLSocketParams::ConnectionType SSLSocketParams::GetConnectionType() const {
63 if (direct_params_.get()) {
64 DCHECK(!socks_proxy_params_.get());
65 DCHECK(!http_proxy_params_.get());
66 return DIRECT;
69 if (socks_proxy_params_.get()) {
70 DCHECK(!http_proxy_params_.get());
71 return SOCKS_PROXY;
74 DCHECK(http_proxy_params_.get());
75 return HTTP_PROXY;
78 const scoped_refptr<TransportSocketParams>&
79 SSLSocketParams::GetDirectConnectionParams() const {
80 DCHECK_EQ(GetConnectionType(), DIRECT);
81 return direct_params_;
84 const scoped_refptr<SOCKSSocketParams>&
85 SSLSocketParams::GetSocksProxyConnectionParams() const {
86 DCHECK_EQ(GetConnectionType(), SOCKS_PROXY);
87 return socks_proxy_params_;
90 const scoped_refptr<HttpProxySocketParams>&
91 SSLSocketParams::GetHttpProxyConnectionParams() const {
92 DCHECK_EQ(GetConnectionType(), HTTP_PROXY);
93 return http_proxy_params_;
96 // Timeout for the SSL handshake portion of the connect.
97 static const int kSSLHandshakeTimeoutInSeconds = 30;
99 SSLConnectJob::SSLConnectJob(const std::string& group_name,
100 RequestPriority priority,
101 const scoped_refptr<SSLSocketParams>& params,
102 const base::TimeDelta& timeout_duration,
103 TransportClientSocketPool* transport_pool,
104 SOCKSClientSocketPool* socks_pool,
105 HttpProxyClientSocketPool* http_proxy_pool,
106 ClientSocketFactory* client_socket_factory,
107 const SSLClientSocketContext& context,
108 Delegate* delegate,
109 NetLog* net_log)
110 : ConnectJob(group_name,
111 timeout_duration,
112 priority,
113 delegate,
114 BoundNetLog::Make(net_log, NetLog::SOURCE_CONNECT_JOB)),
115 params_(params),
116 transport_pool_(transport_pool),
117 socks_pool_(socks_pool),
118 http_proxy_pool_(http_proxy_pool),
119 client_socket_factory_(client_socket_factory),
120 context_(context.cert_verifier,
121 context.channel_id_service,
122 context.transport_security_state,
123 context.cert_transparency_verifier,
124 context.cert_policy_enforcer,
125 (params->privacy_mode() == PRIVACY_MODE_ENABLED
126 ? "pm/" + context.ssl_session_cache_shard
127 : context.ssl_session_cache_shard)),
128 callback_(
129 base::Bind(&SSLConnectJob::OnIOComplete, base::Unretained(this))) {
132 SSLConnectJob::~SSLConnectJob() {
135 LoadState SSLConnectJob::GetLoadState() const {
136 switch (next_state_) {
137 case STATE_TUNNEL_CONNECT_COMPLETE:
138 if (transport_socket_handle_->socket())
139 return LOAD_STATE_ESTABLISHING_PROXY_TUNNEL;
140 // else, fall through.
141 case STATE_TRANSPORT_CONNECT:
142 case STATE_TRANSPORT_CONNECT_COMPLETE:
143 case STATE_SOCKS_CONNECT:
144 case STATE_SOCKS_CONNECT_COMPLETE:
145 case STATE_TUNNEL_CONNECT:
146 return transport_socket_handle_->GetLoadState();
147 case STATE_SSL_CONNECT:
148 case STATE_SSL_CONNECT_COMPLETE:
149 return LOAD_STATE_SSL_HANDSHAKE;
150 default:
151 NOTREACHED();
152 return LOAD_STATE_IDLE;
156 void SSLConnectJob::GetAdditionalErrorState(ClientSocketHandle* handle) {
157 // Headers in |error_response_info_| indicate a proxy tunnel setup
158 // problem. See DoTunnelConnectComplete.
159 if (error_response_info_.headers.get()) {
160 handle->set_pending_http_proxy_connection(
161 transport_socket_handle_.release());
163 handle->set_ssl_error_response_info(error_response_info_);
164 if (!connect_timing_.ssl_start.is_null())
165 handle->set_is_ssl_error(true);
167 handle->set_connection_attempts(connection_attempts_);
170 void SSLConnectJob::OnIOComplete(int result) {
171 int rv = DoLoop(result);
172 if (rv != ERR_IO_PENDING)
173 NotifyDelegateOfCompletion(rv); // Deletes |this|.
176 int SSLConnectJob::DoLoop(int result) {
177 DCHECK_NE(next_state_, STATE_NONE);
179 int rv = result;
180 do {
181 State state = next_state_;
182 next_state_ = STATE_NONE;
183 switch (state) {
184 case STATE_TRANSPORT_CONNECT:
185 DCHECK_EQ(OK, rv);
186 rv = DoTransportConnect();
187 break;
188 case STATE_TRANSPORT_CONNECT_COMPLETE:
189 rv = DoTransportConnectComplete(rv);
190 break;
191 case STATE_SOCKS_CONNECT:
192 DCHECK_EQ(OK, rv);
193 rv = DoSOCKSConnect();
194 break;
195 case STATE_SOCKS_CONNECT_COMPLETE:
196 rv = DoSOCKSConnectComplete(rv);
197 break;
198 case STATE_TUNNEL_CONNECT:
199 DCHECK_EQ(OK, rv);
200 rv = DoTunnelConnect();
201 break;
202 case STATE_TUNNEL_CONNECT_COMPLETE:
203 rv = DoTunnelConnectComplete(rv);
204 break;
205 case STATE_SSL_CONNECT:
206 DCHECK_EQ(OK, rv);
207 rv = DoSSLConnect();
208 break;
209 case STATE_SSL_CONNECT_COMPLETE:
210 rv = DoSSLConnectComplete(rv);
211 break;
212 default:
213 NOTREACHED() << "bad state";
214 rv = ERR_FAILED;
215 break;
217 } while (rv != ERR_IO_PENDING && next_state_ != STATE_NONE);
219 return rv;
222 int SSLConnectJob::DoTransportConnect() {
223 DCHECK(transport_pool_);
225 next_state_ = STATE_TRANSPORT_CONNECT_COMPLETE;
226 transport_socket_handle_.reset(new ClientSocketHandle());
227 scoped_refptr<TransportSocketParams> direct_params =
228 params_->GetDirectConnectionParams();
229 return transport_socket_handle_->Init(group_name(), direct_params, priority(),
230 callback_, transport_pool_, net_log());
233 int SSLConnectJob::DoTransportConnectComplete(int result) {
234 connection_attempts_ = transport_socket_handle_->connection_attempts();
235 if (result == OK) {
236 next_state_ = STATE_SSL_CONNECT;
237 transport_socket_handle_->socket()->GetPeerAddress(&server_address_);
240 return result;
243 int SSLConnectJob::DoSOCKSConnect() {
244 DCHECK(socks_pool_);
245 next_state_ = STATE_SOCKS_CONNECT_COMPLETE;
246 transport_socket_handle_.reset(new ClientSocketHandle());
247 scoped_refptr<SOCKSSocketParams> socks_proxy_params =
248 params_->GetSocksProxyConnectionParams();
249 return transport_socket_handle_->Init(group_name(), socks_proxy_params,
250 priority(), callback_, socks_pool_,
251 net_log());
254 int SSLConnectJob::DoSOCKSConnectComplete(int result) {
255 if (result == OK)
256 next_state_ = STATE_SSL_CONNECT;
258 return result;
261 int SSLConnectJob::DoTunnelConnect() {
262 DCHECK(http_proxy_pool_);
263 next_state_ = STATE_TUNNEL_CONNECT_COMPLETE;
265 transport_socket_handle_.reset(new ClientSocketHandle());
266 scoped_refptr<HttpProxySocketParams> http_proxy_params =
267 params_->GetHttpProxyConnectionParams();
268 return transport_socket_handle_->Init(group_name(), http_proxy_params,
269 priority(), callback_, http_proxy_pool_,
270 net_log());
273 int SSLConnectJob::DoTunnelConnectComplete(int result) {
274 // Extract the information needed to prompt for appropriate proxy
275 // authentication so that when ClientSocketPoolBaseHelper calls
276 // |GetAdditionalErrorState|, we can easily set the state.
277 if (result == ERR_SSL_CLIENT_AUTH_CERT_NEEDED) {
278 error_response_info_ = transport_socket_handle_->ssl_error_response_info();
279 } else if (result == ERR_PROXY_AUTH_REQUESTED ||
280 result == ERR_HTTPS_PROXY_TUNNEL_RESPONSE) {
281 StreamSocket* socket = transport_socket_handle_->socket();
282 ProxyClientSocket* tunnel_socket = static_cast<ProxyClientSocket*>(socket);
283 error_response_info_ = *tunnel_socket->GetConnectResponseInfo();
285 if (result < 0)
286 return result;
288 next_state_ = STATE_SSL_CONNECT;
289 return result;
292 int SSLConnectJob::DoSSLConnect() {
293 // TODO(pkasting): Remove ScopedTracker below once crbug.com/462815 is fixed.
294 tracked_objects::ScopedTracker tracking_profile(
295 FROM_HERE_WITH_EXPLICIT_FUNCTION("462815 SSLConnectJob::DoSSLConnect"));
297 next_state_ = STATE_SSL_CONNECT_COMPLETE;
299 // Reset the timeout to just the time allowed for the SSL handshake.
300 ResetTimer(base::TimeDelta::FromSeconds(kSSLHandshakeTimeoutInSeconds));
302 // If the handle has a fresh socket, get its connect start and DNS times.
303 // This should always be the case.
304 const LoadTimingInfo::ConnectTiming& socket_connect_timing =
305 transport_socket_handle_->connect_timing();
306 if (!transport_socket_handle_->is_reused() &&
307 !socket_connect_timing.connect_start.is_null()) {
308 // Overwriting |connect_start| serves two purposes - it adjusts timing so
309 // |connect_start| doesn't include dns times, and it adjusts the time so
310 // as not to include time spent waiting for an idle socket.
311 connect_timing_.connect_start = socket_connect_timing.connect_start;
312 connect_timing_.dns_start = socket_connect_timing.dns_start;
313 connect_timing_.dns_end = socket_connect_timing.dns_end;
316 connect_timing_.ssl_start = base::TimeTicks::Now();
318 ssl_socket_ = client_socket_factory_->CreateSSLClientSocket(
319 transport_socket_handle_.Pass(),
320 params_->host_and_port(),
321 params_->ssl_config(),
322 context_);
323 return ssl_socket_->Connect(callback_);
326 int SSLConnectJob::DoSSLConnectComplete(int result) {
327 // TODO(rvargas): Remove ScopedTracker below once crbug.com/462784 is fixed.
328 tracked_objects::ScopedTracker tracking_profile(
329 FROM_HERE_WITH_EXPLICIT_FUNCTION(
330 "462784 SSLConnectJob::DoSSLConnectComplete"));
332 connect_timing_.ssl_end = base::TimeTicks::Now();
334 if (result != OK && !server_address_.address().empty()) {
335 connection_attempts_.push_back(ConnectionAttempt(server_address_, result));
336 server_address_ = IPEndPoint();
339 // If we want SPDY over ALPN/NPN, make sure it succeeded.
340 if (params_->want_spdy_over_npn() &&
341 !NextProtoIsSPDY(ssl_socket_->GetNegotiatedProtocol())) {
342 return ERR_NPN_NEGOTIATION_FAILED;
345 if (result == OK ||
346 ssl_socket_->IgnoreCertError(result, params_->load_flags())) {
347 DCHECK(!connect_timing_.ssl_start.is_null());
348 base::TimeDelta connect_duration =
349 connect_timing_.ssl_end - connect_timing_.ssl_start;
350 if (params_->want_spdy_over_npn()) {
351 UMA_HISTOGRAM_CUSTOM_TIMES("Net.SpdyConnectionLatency_2",
352 connect_duration,
353 base::TimeDelta::FromMilliseconds(1),
354 base::TimeDelta::FromMinutes(1),
355 100);
358 UMA_HISTOGRAM_CUSTOM_TIMES("Net.SSL_Connection_Latency_2",
359 connect_duration,
360 base::TimeDelta::FromMilliseconds(1),
361 base::TimeDelta::FromMinutes(1),
362 100);
364 SSLInfo ssl_info;
365 bool has_ssl_info = ssl_socket_->GetSSLInfo(&ssl_info);
366 DCHECK(has_ssl_info);
368 UMA_HISTOGRAM_ENUMERATION("Net.SSLVersion", SSLConnectionStatusToVersion(
369 ssl_info.connection_status),
370 SSL_CONNECTION_VERSION_MAX);
372 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.SSL_CipherSuite",
373 SSLConnectionStatusToCipherSuite(
374 ssl_info.connection_status));
376 if (ssl_info.handshake_type == SSLInfo::HANDSHAKE_RESUME) {
377 UMA_HISTOGRAM_CUSTOM_TIMES("Net.SSL_Connection_Latency_Resume_Handshake",
378 connect_duration,
379 base::TimeDelta::FromMilliseconds(1),
380 base::TimeDelta::FromMinutes(1),
381 100);
382 } else if (ssl_info.handshake_type == SSLInfo::HANDSHAKE_FULL) {
383 UMA_HISTOGRAM_CUSTOM_TIMES("Net.SSL_Connection_Latency_Full_Handshake",
384 connect_duration,
385 base::TimeDelta::FromMilliseconds(1),
386 base::TimeDelta::FromMinutes(1),
387 100);
390 const std::string& host = params_->host_and_port().host();
391 bool is_google =
392 host == "google.com" ||
393 (host.size() > 11 && host.rfind(".google.com") == host.size() - 11);
394 if (is_google) {
395 UMA_HISTOGRAM_CUSTOM_TIMES("Net.SSL_Connection_Latency_Google2",
396 connect_duration,
397 base::TimeDelta::FromMilliseconds(1),
398 base::TimeDelta::FromMinutes(1),
399 100);
400 if (ssl_info.handshake_type == SSLInfo::HANDSHAKE_RESUME) {
401 UMA_HISTOGRAM_CUSTOM_TIMES("Net.SSL_Connection_Latency_Google_"
402 "Resume_Handshake",
403 connect_duration,
404 base::TimeDelta::FromMilliseconds(1),
405 base::TimeDelta::FromMinutes(1),
406 100);
407 } else if (ssl_info.handshake_type == SSLInfo::HANDSHAKE_FULL) {
408 UMA_HISTOGRAM_CUSTOM_TIMES("Net.SSL_Connection_Latency_Google_"
409 "Full_Handshake",
410 connect_duration,
411 base::TimeDelta::FromMilliseconds(1),
412 base::TimeDelta::FromMinutes(1),
413 100);
418 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.SSL_Connection_Error", std::abs(result));
419 if (params_->ssl_config().fastradio_padding_eligible) {
420 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.SSL_Connection_Error_FastRadioPadding",
421 std::abs(result));
424 if (result == OK || IsCertificateError(result)) {
425 SetSocket(ssl_socket_.Pass());
426 } else if (result == ERR_SSL_CLIENT_AUTH_CERT_NEEDED) {
427 error_response_info_.cert_request_info = new SSLCertRequestInfo;
428 ssl_socket_->GetSSLCertRequestInfo(
429 error_response_info_.cert_request_info.get());
432 return result;
435 SSLConnectJob::State SSLConnectJob::GetInitialState(
436 SSLSocketParams::ConnectionType connection_type) {
437 switch (connection_type) {
438 case SSLSocketParams::DIRECT:
439 return STATE_TRANSPORT_CONNECT;
440 case SSLSocketParams::HTTP_PROXY:
441 return STATE_TUNNEL_CONNECT;
442 case SSLSocketParams::SOCKS_PROXY:
443 return STATE_SOCKS_CONNECT;
445 NOTREACHED();
446 return STATE_NONE;
449 int SSLConnectJob::ConnectInternal() {
450 next_state_ = GetInitialState(params_->GetConnectionType());
451 return DoLoop(OK);
454 SSLClientSocketPool::SSLConnectJobFactory::SSLConnectJobFactory(
455 TransportClientSocketPool* transport_pool,
456 SOCKSClientSocketPool* socks_pool,
457 HttpProxyClientSocketPool* http_proxy_pool,
458 ClientSocketFactory* client_socket_factory,
459 const SSLClientSocketContext& context,
460 NetLog* net_log)
461 : transport_pool_(transport_pool),
462 socks_pool_(socks_pool),
463 http_proxy_pool_(http_proxy_pool),
464 client_socket_factory_(client_socket_factory),
465 context_(context),
466 net_log_(net_log) {
467 base::TimeDelta max_transport_timeout = base::TimeDelta();
468 base::TimeDelta pool_timeout;
469 if (transport_pool_)
470 max_transport_timeout = transport_pool_->ConnectionTimeout();
471 if (socks_pool_) {
472 pool_timeout = socks_pool_->ConnectionTimeout();
473 if (pool_timeout > max_transport_timeout)
474 max_transport_timeout = pool_timeout;
476 if (http_proxy_pool_) {
477 pool_timeout = http_proxy_pool_->ConnectionTimeout();
478 if (pool_timeout > max_transport_timeout)
479 max_transport_timeout = pool_timeout;
481 timeout_ = max_transport_timeout +
482 base::TimeDelta::FromSeconds(kSSLHandshakeTimeoutInSeconds);
485 SSLClientSocketPool::SSLConnectJobFactory::~SSLConnectJobFactory() {
488 SSLClientSocketPool::SSLClientSocketPool(
489 int max_sockets,
490 int max_sockets_per_group,
491 CertVerifier* cert_verifier,
492 ChannelIDService* channel_id_service,
493 TransportSecurityState* transport_security_state,
494 CTVerifier* cert_transparency_verifier,
495 CertPolicyEnforcer* cert_policy_enforcer,
496 const std::string& ssl_session_cache_shard,
497 ClientSocketFactory* client_socket_factory,
498 TransportClientSocketPool* transport_pool,
499 SOCKSClientSocketPool* socks_pool,
500 HttpProxyClientSocketPool* http_proxy_pool,
501 SSLConfigService* ssl_config_service,
502 NetLog* net_log)
503 : transport_pool_(transport_pool),
504 socks_pool_(socks_pool),
505 http_proxy_pool_(http_proxy_pool),
506 base_(this,
507 max_sockets,
508 max_sockets_per_group,
509 ClientSocketPool::unused_idle_socket_timeout(),
510 ClientSocketPool::used_idle_socket_timeout(),
511 new SSLConnectJobFactory(
512 transport_pool,
513 socks_pool,
514 http_proxy_pool,
515 client_socket_factory,
516 SSLClientSocketContext(cert_verifier,
517 channel_id_service,
518 transport_security_state,
519 cert_transparency_verifier,
520 cert_policy_enforcer,
521 ssl_session_cache_shard),
522 net_log)),
523 ssl_config_service_(ssl_config_service) {
524 if (ssl_config_service_.get())
525 ssl_config_service_->AddObserver(this);
526 if (transport_pool_)
527 base_.AddLowerLayeredPool(transport_pool_);
528 if (socks_pool_)
529 base_.AddLowerLayeredPool(socks_pool_);
530 if (http_proxy_pool_)
531 base_.AddLowerLayeredPool(http_proxy_pool_);
534 SSLClientSocketPool::~SSLClientSocketPool() {
535 if (ssl_config_service_.get())
536 ssl_config_service_->RemoveObserver(this);
539 scoped_ptr<ConnectJob> SSLClientSocketPool::SSLConnectJobFactory::NewConnectJob(
540 const std::string& group_name,
541 const PoolBase::Request& request,
542 ConnectJob::Delegate* delegate) const {
543 return scoped_ptr<ConnectJob>(new SSLConnectJob(group_name,
544 request.priority(),
545 request.params(),
546 ConnectionTimeout(),
547 transport_pool_,
548 socks_pool_,
549 http_proxy_pool_,
550 client_socket_factory_,
551 context_,
552 delegate,
553 net_log_));
556 base::TimeDelta SSLClientSocketPool::SSLConnectJobFactory::ConnectionTimeout()
557 const {
558 return timeout_;
561 int SSLClientSocketPool::RequestSocket(const std::string& group_name,
562 const void* socket_params,
563 RequestPriority priority,
564 ClientSocketHandle* handle,
565 const CompletionCallback& callback,
566 const BoundNetLog& net_log) {
567 const scoped_refptr<SSLSocketParams>* casted_socket_params =
568 static_cast<const scoped_refptr<SSLSocketParams>*>(socket_params);
570 return base_.RequestSocket(group_name, *casted_socket_params, priority,
571 handle, callback, net_log);
574 void SSLClientSocketPool::RequestSockets(
575 const std::string& group_name,
576 const void* params,
577 int num_sockets,
578 const BoundNetLog& net_log) {
579 const scoped_refptr<SSLSocketParams>* casted_params =
580 static_cast<const scoped_refptr<SSLSocketParams>*>(params);
582 base_.RequestSockets(group_name, *casted_params, num_sockets, net_log);
585 void SSLClientSocketPool::CancelRequest(const std::string& group_name,
586 ClientSocketHandle* handle) {
587 base_.CancelRequest(group_name, handle);
590 void SSLClientSocketPool::ReleaseSocket(const std::string& group_name,
591 scoped_ptr<StreamSocket> socket,
592 int id) {
593 base_.ReleaseSocket(group_name, socket.Pass(), id);
596 void SSLClientSocketPool::FlushWithError(int error) {
597 base_.FlushWithError(error);
600 void SSLClientSocketPool::CloseIdleSockets() {
601 base_.CloseIdleSockets();
604 int SSLClientSocketPool::IdleSocketCount() const {
605 return base_.idle_socket_count();
608 int SSLClientSocketPool::IdleSocketCountInGroup(
609 const std::string& group_name) const {
610 return base_.IdleSocketCountInGroup(group_name);
613 LoadState SSLClientSocketPool::GetLoadState(
614 const std::string& group_name, const ClientSocketHandle* handle) const {
615 return base_.GetLoadState(group_name, handle);
618 base::DictionaryValue* SSLClientSocketPool::GetInfoAsValue(
619 const std::string& name,
620 const std::string& type,
621 bool include_nested_pools) const {
622 base::DictionaryValue* dict = base_.GetInfoAsValue(name, type);
623 if (include_nested_pools) {
624 base::ListValue* list = new base::ListValue();
625 if (transport_pool_) {
626 list->Append(transport_pool_->GetInfoAsValue("transport_socket_pool",
627 "transport_socket_pool",
628 false));
630 if (socks_pool_) {
631 list->Append(socks_pool_->GetInfoAsValue("socks_pool",
632 "socks_pool",
633 true));
635 if (http_proxy_pool_) {
636 list->Append(http_proxy_pool_->GetInfoAsValue("http_proxy_pool",
637 "http_proxy_pool",
638 true));
640 dict->Set("nested_pools", list);
642 return dict;
645 base::TimeDelta SSLClientSocketPool::ConnectionTimeout() const {
646 return base_.ConnectionTimeout();
649 bool SSLClientSocketPool::IsStalled() const {
650 return base_.IsStalled();
653 void SSLClientSocketPool::AddHigherLayeredPool(HigherLayeredPool* higher_pool) {
654 base_.AddHigherLayeredPool(higher_pool);
657 void SSLClientSocketPool::RemoveHigherLayeredPool(
658 HigherLayeredPool* higher_pool) {
659 base_.RemoveHigherLayeredPool(higher_pool);
662 bool SSLClientSocketPool::CloseOneIdleConnection() {
663 if (base_.CloseOneIdleSocket())
664 return true;
665 return base_.CloseOneIdleConnectionInHigherLayeredPool();
668 void SSLClientSocketPool::OnSSLConfigChanged() {
669 FlushWithError(ERR_NETWORK_CHANGED);
672 } // namespace net