| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/http/http_proxy_client_socket_wrapper.h" | 5 #include "net/http/http_proxy_client_socket_wrapper.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 SetConnectTimer(proxy_negotiation_timeout_duration_); | 417 SetConnectTimer(proxy_negotiation_timeout_duration_); |
| 418 | 418 |
| 419 next_state_ = STATE_HTTP_PROXY_CONNECT; | 419 next_state_ = STATE_HTTP_PROXY_CONNECT; |
| 420 return result; | 420 return result; |
| 421 } | 421 } |
| 422 | 422 |
| 423 int HttpProxyClientSocketWrapper::DoSSLConnect() { | 423 int HttpProxyClientSocketWrapper::DoSSLConnect() { |
| 424 if (tunnel_) { | 424 if (tunnel_) { |
| 425 SpdySessionKey key(GetDestination().host_port_pair(), ProxyServer::Direct(), | 425 SpdySessionKey key(GetDestination().host_port_pair(), ProxyServer::Direct(), |
| 426 PRIVACY_MODE_DISABLED); | 426 PRIVACY_MODE_DISABLED); |
| 427 if (spdy_session_pool_->FindAvailableSession(key, GURL(), net_log_)) { | 427 if (spdy_session_pool_->FindAvailableSession( |
| 428 key, GURL(), |
| 429 /* enable_ip_based_pooling = */ true, net_log_)) { |
| 428 using_spdy_ = true; | 430 using_spdy_ = true; |
| 429 next_state_ = STATE_SPDY_PROXY_CREATE_STREAM; | 431 next_state_ = STATE_SPDY_PROXY_CREATE_STREAM; |
| 430 return OK; | 432 return OK; |
| 431 } | 433 } |
| 432 } | 434 } |
| 433 next_state_ = STATE_SSL_CONNECT_COMPLETE; | 435 next_state_ = STATE_SSL_CONNECT_COMPLETE; |
| 434 transport_socket_handle_.reset(new ClientSocketHandle()); | 436 transport_socket_handle_.reset(new ClientSocketHandle()); |
| 435 return transport_socket_handle_->Init( | 437 return transport_socket_handle_->Init( |
| 436 group_name_, ssl_params_, priority_, respect_limits_, | 438 group_name_, ssl_params_, priority_, respect_limits_, |
| 437 base::Bind(&HttpProxyClientSocketWrapper::OnIOComplete, | 439 base::Bind(&HttpProxyClientSocketWrapper::OnIOComplete, |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 515 | 517 |
| 516 return result; | 518 return result; |
| 517 } | 519 } |
| 518 | 520 |
| 519 int HttpProxyClientSocketWrapper::DoSpdyProxyCreateStream() { | 521 int HttpProxyClientSocketWrapper::DoSpdyProxyCreateStream() { |
| 520 DCHECK(using_spdy_); | 522 DCHECK(using_spdy_); |
| 521 DCHECK(tunnel_); | 523 DCHECK(tunnel_); |
| 522 SpdySessionKey key(GetDestination().host_port_pair(), ProxyServer::Direct(), | 524 SpdySessionKey key(GetDestination().host_port_pair(), ProxyServer::Direct(), |
| 523 PRIVACY_MODE_DISABLED); | 525 PRIVACY_MODE_DISABLED); |
| 524 base::WeakPtr<SpdySession> spdy_session = | 526 base::WeakPtr<SpdySession> spdy_session = |
| 525 spdy_session_pool_->FindAvailableSession(key, GURL(), net_log_); | 527 spdy_session_pool_->FindAvailableSession( |
| 528 key, GURL(), |
| 529 /* enable_ip_based_pooling = */ true, net_log_); |
| 526 // It's possible that a session to the proxy has recently been created | 530 // It's possible that a session to the proxy has recently been created |
| 527 if (spdy_session) { | 531 if (spdy_session) { |
| 528 if (transport_socket_handle_.get()) { | 532 if (transport_socket_handle_.get()) { |
| 529 if (transport_socket_handle_->socket()) | 533 if (transport_socket_handle_->socket()) |
| 530 transport_socket_handle_->socket()->Disconnect(); | 534 transport_socket_handle_->socket()->Disconnect(); |
| 531 transport_socket_handle_->Reset(); | 535 transport_socket_handle_->Reset(); |
| 532 } | 536 } |
| 533 } else { | 537 } else { |
| 534 // Create a session direct to the proxy itself | 538 // Create a session direct to the proxy itself |
| 535 spdy_session = spdy_session_pool_->CreateAvailableSessionFromSocket( | 539 spdy_session = spdy_session_pool_->CreateAvailableSessionFromSocket( |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 624 const HostResolver::RequestInfo& | 628 const HostResolver::RequestInfo& |
| 625 HttpProxyClientSocketWrapper::GetDestination() { | 629 HttpProxyClientSocketWrapper::GetDestination() { |
| 626 if (transport_params_) { | 630 if (transport_params_) { |
| 627 return transport_params_->destination(); | 631 return transport_params_->destination(); |
| 628 } else { | 632 } else { |
| 629 return ssl_params_->GetDirectConnectionParams()->destination(); | 633 return ssl_params_->GetDirectConnectionParams()->destination(); |
| 630 } | 634 } |
| 631 } | 635 } |
| 632 | 636 |
| 633 } // namespace net | 637 } // namespace net |
| OLD | NEW |