| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/socket/ssl_client_socket_pool.h" | 5 #include "net/socket/ssl_client_socket_pool.h" |
| 6 | 6 |
| 7 #include "net/base/net_errors.h" | 7 #include "net/base/net_errors.h" |
| 8 #include "net/http/http_proxy_client_socket.h" | 8 #include "net/http/http_proxy_client_socket.h" |
| 9 #include "net/http/http_proxy_client_socket_pool.h" | 9 #include "net/http/http_proxy_client_socket_pool.h" |
| 10 #include "net/socket/client_socket_factory.h" | 10 #include "net/socket/client_socket_factory.h" |
| 11 #include "net/socket/client_socket_handle.h" | 11 #include "net/socket/client_socket_handle.h" |
| 12 #include "net/socket/socks_client_socket_pool.h" | 12 #include "net/socket/socks_client_socket_pool.h" |
| 13 #include "net/socket/ssl_client_socket.h" | 13 #include "net/socket/ssl_client_socket.h" |
| 14 #include "net/socket/tcp_client_socket_pool.h" | 14 #include "net/socket/tcp_client_socket_pool.h" |
| 15 | 15 |
| 16 namespace net { | 16 namespace net { |
| 17 | 17 |
| 18 SSLSocketParams::SSLSocketParams( | 18 SSLSocketParams::SSLSocketParams( |
| 19 const scoped_refptr<TCPSocketParams>& tcp_params, | 19 const scoped_refptr<TCPSocketParams>& tcp_params, |
| 20 const scoped_refptr<HttpProxySocketParams>& http_proxy_params, | 20 const scoped_refptr<HttpProxySocketParams>& http_proxy_params, |
| 21 const scoped_refptr<SOCKSSocketParams>& socks_params, | 21 const scoped_refptr<SOCKSSocketParams>& socks_params, |
| 22 ProxyServer::Scheme proxy, | 22 ProxyServer::Scheme proxy, |
| 23 const std::string& hostname, | 23 const HostPortPair& host_port_pair, |
| 24 const SSLConfig& ssl_config, | 24 const SSLConfig& ssl_config, |
| 25 int load_flags, | 25 int load_flags, |
| 26 bool force_spdy_over_ssl, | 26 bool force_spdy_over_ssl, |
| 27 bool want_spdy_over_npn) | 27 bool want_spdy_over_npn) |
| 28 : tcp_params_(tcp_params), | 28 : tcp_params_(tcp_params), |
| 29 http_proxy_params_(http_proxy_params), | 29 http_proxy_params_(http_proxy_params), |
| 30 socks_params_(socks_params), | 30 socks_params_(socks_params), |
| 31 proxy_(proxy), | 31 proxy_(proxy), |
| 32 hostname_(hostname), | 32 host_port_pair_(host_port_pair), |
| 33 ssl_config_(ssl_config), | 33 ssl_config_(ssl_config), |
| 34 load_flags_(load_flags), | 34 load_flags_(load_flags), |
| 35 force_spdy_over_ssl_(force_spdy_over_ssl), | 35 force_spdy_over_ssl_(force_spdy_over_ssl), |
| 36 want_spdy_over_npn_(want_spdy_over_npn) { | 36 want_spdy_over_npn_(want_spdy_over_npn) { |
| 37 switch (proxy_) { | 37 switch (proxy_) { |
| 38 case ProxyServer::SCHEME_DIRECT: | 38 case ProxyServer::SCHEME_DIRECT: |
| 39 DCHECK(tcp_params_.get() != NULL); | 39 DCHECK(tcp_params_.get() != NULL); |
| 40 DCHECK(http_proxy_params_.get() == NULL); | 40 DCHECK(http_proxy_params_.get() == NULL); |
| 41 DCHECK(socks_params_.get() == NULL); | 41 DCHECK(socks_params_.get() == NULL); |
| 42 break; | 42 break; |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 handle->set_is_ssl_error(true); | 256 handle->set_is_ssl_error(true); |
| 257 } | 257 } |
| 258 | 258 |
| 259 int SSLConnectJob::DoSSLConnect() { | 259 int SSLConnectJob::DoSSLConnect() { |
| 260 next_state_ = STATE_SSL_CONNECT_COMPLETE; | 260 next_state_ = STATE_SSL_CONNECT_COMPLETE; |
| 261 // Reset the timeout to just the time allowed for the SSL handshake. | 261 // Reset the timeout to just the time allowed for the SSL handshake. |
| 262 ResetTimer(base::TimeDelta::FromSeconds(kSSLHandshakeTimeoutInSeconds)); | 262 ResetTimer(base::TimeDelta::FromSeconds(kSSLHandshakeTimeoutInSeconds)); |
| 263 ssl_connect_start_time_ = base::TimeTicks::Now(); | 263 ssl_connect_start_time_ = base::TimeTicks::Now(); |
| 264 | 264 |
| 265 ssl_socket_.reset(client_socket_factory_->CreateSSLClientSocket( | 265 ssl_socket_.reset(client_socket_factory_->CreateSSLClientSocket( |
| 266 transport_socket_handle_.release(), params_->hostname(), | 266 transport_socket_handle_.release(), params_->host_port_pair(), |
| 267 params_->ssl_config())); | 267 params_->ssl_config())); |
| 268 return ssl_socket_->Connect(&callback_); | 268 return ssl_socket_->Connect(&callback_); |
| 269 } | 269 } |
| 270 | 270 |
| 271 int SSLConnectJob::DoSSLConnectComplete(int result) { | 271 int SSLConnectJob::DoSSLConnectComplete(int result) { |
| 272 SSLClientSocket::NextProtoStatus status = | 272 SSLClientSocket::NextProtoStatus status = |
| 273 SSLClientSocket::kNextProtoUnsupported; | 273 SSLClientSocket::kNextProtoUnsupported; |
| 274 std::string proto; | 274 std::string proto; |
| 275 // GetNextProto will fail and and trigger a NOTREACHED if we pass in a socket | 275 // GetNextProto will fail and and trigger a NOTREACHED if we pass in a socket |
| 276 // that hasn't had SSL_ImportFD called on it. If we get a certificate error | 276 // that hasn't had SSL_ImportFD called on it. If we get a certificate error |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 424 const std::string& group_name) const { | 424 const std::string& group_name) const { |
| 425 return base_.IdleSocketCountInGroup(group_name); | 425 return base_.IdleSocketCountInGroup(group_name); |
| 426 } | 426 } |
| 427 | 427 |
| 428 LoadState SSLClientSocketPool::GetLoadState( | 428 LoadState SSLClientSocketPool::GetLoadState( |
| 429 const std::string& group_name, const ClientSocketHandle* handle) const { | 429 const std::string& group_name, const ClientSocketHandle* handle) const { |
| 430 return base_.GetLoadState(group_name, handle); | 430 return base_.GetLoadState(group_name, handle); |
| 431 } | 431 } |
| 432 | 432 |
| 433 } // namespace net | 433 } // namespace net |
| OLD | NEW |