| 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/base/ssl_cert_request_info.h" | 8 #include "net/base/ssl_cert_request_info.h" |
| 9 #include "net/http/http_proxy_client_socket.h" | 9 #include "net/http/http_proxy_client_socket.h" |
| 10 #include "net/http/http_proxy_client_socket_pool.h" | 10 #include "net/http/http_proxy_client_socket_pool.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 load_flags_(load_flags), | 35 load_flags_(load_flags), |
| 36 force_spdy_over_ssl_(force_spdy_over_ssl), | 36 force_spdy_over_ssl_(force_spdy_over_ssl), |
| 37 want_spdy_over_npn_(want_spdy_over_npn) { | 37 want_spdy_over_npn_(want_spdy_over_npn) { |
| 38 switch (proxy_) { | 38 switch (proxy_) { |
| 39 case ProxyServer::SCHEME_DIRECT: | 39 case ProxyServer::SCHEME_DIRECT: |
| 40 DCHECK(tcp_params_.get() != NULL); | 40 DCHECK(tcp_params_.get() != NULL); |
| 41 DCHECK(http_proxy_params_.get() == NULL); | 41 DCHECK(http_proxy_params_.get() == NULL); |
| 42 DCHECK(socks_params_.get() == NULL); | 42 DCHECK(socks_params_.get() == NULL); |
| 43 break; | 43 break; |
| 44 case ProxyServer::SCHEME_HTTP: | 44 case ProxyServer::SCHEME_HTTP: |
| 45 case ProxyServer::SCHEME_HTTPS: |
| 45 DCHECK(tcp_params_.get() == NULL); | 46 DCHECK(tcp_params_.get() == NULL); |
| 46 DCHECK(http_proxy_params_.get() != NULL); | 47 DCHECK(http_proxy_params_.get() != NULL); |
| 47 DCHECK(socks_params_.get() == NULL); | 48 DCHECK(socks_params_.get() == NULL); |
| 48 break; | 49 break; |
| 49 case ProxyServer::SCHEME_SOCKS4: | 50 case ProxyServer::SCHEME_SOCKS4: |
| 50 case ProxyServer::SCHEME_SOCKS5: | 51 case ProxyServer::SCHEME_SOCKS5: |
| 51 DCHECK(tcp_params_.get() == NULL); | 52 DCHECK(tcp_params_.get() == NULL); |
| 52 DCHECK(http_proxy_params_.get() == NULL); | 53 DCHECK(http_proxy_params_.get() == NULL); |
| 53 DCHECK(socks_params_.get() != NULL); | 54 DCHECK(socks_params_.get() != NULL); |
| 54 break; | 55 break; |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 return LOAD_STATE_IDLE; | 108 return LOAD_STATE_IDLE; |
| 108 } | 109 } |
| 109 } | 110 } |
| 110 | 111 |
| 111 int SSLConnectJob::ConnectInternal() { | 112 int SSLConnectJob::ConnectInternal() { |
| 112 switch (params_->proxy()) { | 113 switch (params_->proxy()) { |
| 113 case ProxyServer::SCHEME_DIRECT: | 114 case ProxyServer::SCHEME_DIRECT: |
| 114 next_state_ = STATE_TCP_CONNECT; | 115 next_state_ = STATE_TCP_CONNECT; |
| 115 break; | 116 break; |
| 116 case ProxyServer::SCHEME_HTTP: | 117 case ProxyServer::SCHEME_HTTP: |
| 118 case ProxyServer::SCHEME_HTTPS: |
| 117 next_state_ = STATE_TUNNEL_CONNECT; | 119 next_state_ = STATE_TUNNEL_CONNECT; |
| 118 break; | 120 break; |
| 119 case ProxyServer::SCHEME_SOCKS4: | 121 case ProxyServer::SCHEME_SOCKS4: |
| 120 case ProxyServer::SCHEME_SOCKS5: | 122 case ProxyServer::SCHEME_SOCKS5: |
| 121 next_state_ = STATE_SOCKS_CONNECT; | 123 next_state_ = STATE_SOCKS_CONNECT; |
| 122 break; | 124 break; |
| 123 default: | 125 default: |
| 124 NOTREACHED() << "unknown proxy type"; | 126 NOTREACHED() << "unknown proxy type"; |
| 125 break; | 127 break; |
| 126 } | 128 } |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 | 217 |
| 216 int SSLConnectJob::DoTunnelConnect() { | 218 int SSLConnectJob::DoTunnelConnect() { |
| 217 DCHECK(http_proxy_pool_.get()); | 219 DCHECK(http_proxy_pool_.get()); |
| 218 next_state_ = STATE_TUNNEL_CONNECT_COMPLETE; | 220 next_state_ = STATE_TUNNEL_CONNECT_COMPLETE; |
| 219 | 221 |
| 220 transport_socket_handle_.reset(new ClientSocketHandle()); | 222 transport_socket_handle_.reset(new ClientSocketHandle()); |
| 221 scoped_refptr<HttpProxySocketParams> http_proxy_params = | 223 scoped_refptr<HttpProxySocketParams> http_proxy_params = |
| 222 params_->http_proxy_params(); | 224 params_->http_proxy_params(); |
| 223 return transport_socket_handle_->Init( | 225 return transport_socket_handle_->Init( |
| 224 group_name(), http_proxy_params, | 226 group_name(), http_proxy_params, |
| 225 http_proxy_params->tcp_params()->destination().priority(), &callback_, | 227 http_proxy_params->destination().priority(), &callback_, |
| 226 http_proxy_pool_, net_log()); | 228 http_proxy_pool_, net_log()); |
| 227 } | 229 } |
| 228 | 230 |
| 229 int SSLConnectJob::DoTunnelConnectComplete(int result) { | 231 int SSLConnectJob::DoTunnelConnectComplete(int result) { |
| 230 ClientSocket* socket = transport_socket_handle_->socket(); | 232 ClientSocket* socket = transport_socket_handle_->socket(); |
| 231 HttpProxyClientSocket* tunnel_socket = | 233 HttpProxyClientSocket* tunnel_socket = |
| 232 static_cast<HttpProxyClientSocket*>(socket); | 234 static_cast<HttpProxyClientSocket*>(socket); |
| 233 | 235 |
| 234 // Extract the information needed to prompt for the proxy authentication. | 236 // Extract the information needed to prompt for the proxy authentication. |
| 235 // so that when ClientSocketPoolBaseHelper calls |GetAdditionalErrorState|, | 237 // so that when ClientSocketPoolBaseHelper calls |GetAdditionalErrorState|, |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 424 const std::string& group_name) const { | 426 const std::string& group_name) const { |
| 425 return base_.IdleSocketCountInGroup(group_name); | 427 return base_.IdleSocketCountInGroup(group_name); |
| 426 } | 428 } |
| 427 | 429 |
| 428 LoadState SSLClientSocketPool::GetLoadState( | 430 LoadState SSLClientSocketPool::GetLoadState( |
| 429 const std::string& group_name, const ClientSocketHandle* handle) const { | 431 const std::string& group_name, const ClientSocketHandle* handle) const { |
| 430 return base_.GetLoadState(group_name, handle); | 432 return base_.GetLoadState(group_name, handle); |
| 431 } | 433 } |
| 432 | 434 |
| 433 } // namespace net | 435 } // namespace net |
| OLD | NEW |