| 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" |
| 11 #include "base/callback_helpers.h" | 11 #include "base/callback_helpers.h" |
| 12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
| 13 #include "base/profiler/scoped_tracker.h" | 13 #include "base/profiler/scoped_tracker.h" |
| 14 #include "base/values.h" | 14 #include "base/values.h" |
| 15 #include "net/base/proxy_delegate.h" | 15 #include "net/base/proxy_delegate.h" |
| 16 #include "net/http/http_proxy_client_socket.h" | 16 #include "net/http/http_proxy_client_socket.h" |
| 17 #include "net/http/http_response_info.h" | 17 #include "net/http/http_response_info.h" |
| 18 #include "net/log/net_log_event_type.h" |
| 19 #include "net/log/net_log_source_type.h" |
| 18 #include "net/socket/client_socket_handle.h" | 20 #include "net/socket/client_socket_handle.h" |
| 19 #include "net/spdy/spdy_proxy_client_socket.h" | 21 #include "net/spdy/spdy_proxy_client_socket.h" |
| 20 #include "net/spdy/spdy_session.h" | 22 #include "net/spdy/spdy_session.h" |
| 21 #include "net/spdy/spdy_session_pool.h" | 23 #include "net/spdy/spdy_session_pool.h" |
| 22 #include "net/spdy/spdy_stream.h" | 24 #include "net/spdy/spdy_stream.h" |
| 23 #include "net/ssl/ssl_cert_request_info.h" | 25 #include "net/ssl/ssl_cert_request_info.h" |
| 24 #include "url/gurl.h" | 26 #include "url/gurl.h" |
| 25 | 27 |
| 26 namespace net { | 28 namespace net { |
| 27 | 29 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 using_spdy_(false), | 63 using_spdy_(false), |
| 62 http_auth_controller_( | 64 http_auth_controller_( |
| 63 tunnel ? new HttpAuthController( | 65 tunnel ? new HttpAuthController( |
| 64 HttpAuth::AUTH_PROXY, | 66 HttpAuth::AUTH_PROXY, |
| 65 GURL((ssl_params_.get() ? "https://" : "http://") + | 67 GURL((ssl_params_.get() ? "https://" : "http://") + |
| 66 GetDestination().host_port_pair().ToString()), | 68 GetDestination().host_port_pair().ToString()), |
| 67 http_auth_cache, | 69 http_auth_cache, |
| 68 http_auth_handler_factory) | 70 http_auth_handler_factory) |
| 69 : nullptr), | 71 : nullptr), |
| 70 net_log_(BoundNetLog::Make(net_log.net_log(), | 72 net_log_(BoundNetLog::Make(net_log.net_log(), |
| 71 NetLog::SOURCE_PROXY_CLIENT_SOCKET_WRAPPER)) { | 73 NetLogSourceType::PROXY_CLIENT_SOCKET_WRAPPER)) { |
| 72 net_log_.BeginEvent(NetLog::TYPE_SOCKET_ALIVE, | 74 net_log_.BeginEvent(NetLogEventType::SOCKET_ALIVE, |
| 73 net_log.source().ToEventParametersCallback()); | 75 net_log.source().ToEventParametersCallback()); |
| 74 DCHECK(transport_params || ssl_params); | 76 DCHECK(transport_params || ssl_params); |
| 75 DCHECK(!transport_params || !ssl_params); | 77 DCHECK(!transport_params || !ssl_params); |
| 76 } | 78 } |
| 77 | 79 |
| 78 HttpProxyClientSocketWrapper::~HttpProxyClientSocketWrapper() { | 80 HttpProxyClientSocketWrapper::~HttpProxyClientSocketWrapper() { |
| 79 // Make sure no sockets are returned to the lower level socket pools. | 81 // Make sure no sockets are returned to the lower level socket pools. |
| 80 Disconnect(); | 82 Disconnect(); |
| 81 | 83 |
| 82 net_log_.EndEvent(NetLog::TYPE_SOCKET_ALIVE); | 84 net_log_.EndEvent(NetLogEventType::SOCKET_ALIVE); |
| 83 } | 85 } |
| 84 | 86 |
| 85 LoadState HttpProxyClientSocketWrapper::GetConnectLoadState() const { | 87 LoadState HttpProxyClientSocketWrapper::GetConnectLoadState() const { |
| 86 switch (next_state_) { | 88 switch (next_state_) { |
| 87 case STATE_BEGIN_CONNECT: | 89 case STATE_BEGIN_CONNECT: |
| 88 case STATE_TCP_CONNECT: | 90 case STATE_TCP_CONNECT: |
| 89 case STATE_TCP_CONNECT_COMPLETE: | 91 case STATE_TCP_CONNECT_COMPLETE: |
| 90 case STATE_SSL_CONNECT: | 92 case STATE_SSL_CONNECT: |
| 91 case STATE_SSL_CONNECT_COMPLETE: | 93 case STATE_SSL_CONNECT_COMPLETE: |
| 92 return transport_socket_handle_->GetLoadState(); | 94 return transport_socket_handle_->GetLoadState(); |
| (...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 620 const HostResolver::RequestInfo& | 622 const HostResolver::RequestInfo& |
| 621 HttpProxyClientSocketWrapper::GetDestination() { | 623 HttpProxyClientSocketWrapper::GetDestination() { |
| 622 if (transport_params_) { | 624 if (transport_params_) { |
| 623 return transport_params_->destination(); | 625 return transport_params_->destination(); |
| 624 } else { | 626 } else { |
| 625 return ssl_params_->GetDirectConnectionParams()->destination(); | 627 return ssl_params_->GetDirectConnectionParams()->destination(); |
| 626 } | 628 } |
| 627 } | 629 } |
| 628 | 630 |
| 629 } // namespace net | 631 } // namespace net |
| OLD | NEW |