| 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> |
| 8 |
| 7 #include "base/bind.h" | 9 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| 9 #include "base/callback_helpers.h" | 11 #include "base/callback_helpers.h" |
| 10 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
| 11 #include "base/profiler/scoped_tracker.h" | 13 #include "base/profiler/scoped_tracker.h" |
| 12 #include "base/values.h" | 14 #include "base/values.h" |
| 13 #include "net/base/net_util.h" | 15 #include "net/base/net_util.h" |
| 14 #include "net/base/proxy_delegate.h" | 16 #include "net/base/proxy_delegate.h" |
| 15 #include "net/http/http_proxy_client_socket.h" | 17 #include "net/http/http_proxy_client_socket.h" |
| 16 #include "net/http/http_response_info.h" | 18 #include "net/http/http_response_info.h" |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 case STATE_NONE: | 102 case STATE_NONE: |
| 101 // May be possible for this method to be called after an error, shouldn't | 103 // May be possible for this method to be called after an error, shouldn't |
| 102 // be called after a successful connect. | 104 // be called after a successful connect. |
| 103 break; | 105 break; |
| 104 } | 106 } |
| 105 return LOAD_STATE_IDLE; | 107 return LOAD_STATE_IDLE; |
| 106 } | 108 } |
| 107 | 109 |
| 108 scoped_ptr<HttpResponseInfo> | 110 scoped_ptr<HttpResponseInfo> |
| 109 HttpProxyClientSocketWrapper::GetAdditionalErrorState() { | 111 HttpProxyClientSocketWrapper::GetAdditionalErrorState() { |
| 110 return error_response_info_.Pass(); | 112 return std::move(error_response_info_); |
| 111 } | 113 } |
| 112 | 114 |
| 113 const HttpResponseInfo* HttpProxyClientSocketWrapper::GetConnectResponseInfo() | 115 const HttpResponseInfo* HttpProxyClientSocketWrapper::GetConnectResponseInfo() |
| 114 const { | 116 const { |
| 115 if (transport_socket_) | 117 if (transport_socket_) |
| 116 return transport_socket_->GetConnectResponseInfo(); | 118 return transport_socket_->GetConnectResponseInfo(); |
| 117 return nullptr; | 119 return nullptr; |
| 118 } | 120 } |
| 119 | 121 |
| 120 HttpStream* HttpProxyClientSocketWrapper::CreateConnectResponseStream() { | 122 HttpStream* HttpProxyClientSocketWrapper::CreateConnectResponseStream() { |
| (...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 527 // It's possible that a session to the proxy has recently been created | 529 // It's possible that a session to the proxy has recently been created |
| 528 if (spdy_session) { | 530 if (spdy_session) { |
| 529 if (transport_socket_handle_.get()) { | 531 if (transport_socket_handle_.get()) { |
| 530 if (transport_socket_handle_->socket()) | 532 if (transport_socket_handle_->socket()) |
| 531 transport_socket_handle_->socket()->Disconnect(); | 533 transport_socket_handle_->socket()->Disconnect(); |
| 532 transport_socket_handle_->Reset(); | 534 transport_socket_handle_->Reset(); |
| 533 } | 535 } |
| 534 } else { | 536 } else { |
| 535 // Create a session direct to the proxy itself | 537 // Create a session direct to the proxy itself |
| 536 spdy_session = spdy_session_pool_->CreateAvailableSessionFromSocket( | 538 spdy_session = spdy_session_pool_->CreateAvailableSessionFromSocket( |
| 537 key, transport_socket_handle_.Pass(), net_log_, OK, | 539 key, std::move(transport_socket_handle_), net_log_, OK, |
| 538 /*using_ssl_*/ true); | 540 /*using_ssl_*/ true); |
| 539 DCHECK(spdy_session); | 541 DCHECK(spdy_session); |
| 540 } | 542 } |
| 541 | 543 |
| 542 next_state_ = STATE_SPDY_PROXY_CREATE_STREAM_COMPLETE; | 544 next_state_ = STATE_SPDY_PROXY_CREATE_STREAM_COMPLETE; |
| 543 return spdy_stream_request_.StartRequest( | 545 return spdy_stream_request_.StartRequest( |
| 544 SPDY_BIDIRECTIONAL_STREAM, spdy_session, | 546 SPDY_BIDIRECTIONAL_STREAM, spdy_session, |
| 545 GURL("https://" + endpoint_.ToString()), priority_, | 547 GURL("https://" + endpoint_.ToString()), priority_, |
| 546 spdy_session->net_log(), | 548 spdy_session->net_log(), |
| 547 base::Bind(&HttpProxyClientSocketWrapper::OnIOComplete, | 549 base::Bind(&HttpProxyClientSocketWrapper::OnIOComplete, |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 625 const HostResolver::RequestInfo& | 627 const HostResolver::RequestInfo& |
| 626 HttpProxyClientSocketWrapper::GetDestination() { | 628 HttpProxyClientSocketWrapper::GetDestination() { |
| 627 if (transport_params_) { | 629 if (transport_params_) { |
| 628 return transport_params_->destination(); | 630 return transport_params_->destination(); |
| 629 } else { | 631 } else { |
| 630 return ssl_params_->GetDirectConnectionParams()->destination(); | 632 return ssl_params_->GetDirectConnectionParams()->destination(); |
| 631 } | 633 } |
| 632 } | 634 } |
| 633 | 635 |
| 634 } // namespace net | 636 } // namespace net |
| OLD | NEW |