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 26 matching lines...) Expand all Loading... |
37 SSLClientSocketPool* ssl_pool, | 37 SSLClientSocketPool* ssl_pool, |
38 const scoped_refptr<TransportSocketParams>& transport_params, | 38 const scoped_refptr<TransportSocketParams>& transport_params, |
39 const scoped_refptr<SSLSocketParams>& ssl_params, | 39 const scoped_refptr<SSLSocketParams>& ssl_params, |
40 const std::string& user_agent, | 40 const std::string& user_agent, |
41 const HostPortPair& endpoint, | 41 const HostPortPair& endpoint, |
42 HttpAuthCache* http_auth_cache, | 42 HttpAuthCache* http_auth_cache, |
43 HttpAuthHandlerFactory* http_auth_handler_factory, | 43 HttpAuthHandlerFactory* http_auth_handler_factory, |
44 SpdySessionPool* spdy_session_pool, | 44 SpdySessionPool* spdy_session_pool, |
45 bool tunnel, | 45 bool tunnel, |
46 ProxyDelegate* proxy_delegate, | 46 ProxyDelegate* proxy_delegate, |
47 const BoundNetLog& net_log) | 47 const NetLogWithSource& net_log) |
48 : next_state_(STATE_NONE), | 48 : next_state_(STATE_NONE), |
49 group_name_(group_name), | 49 group_name_(group_name), |
50 priority_(priority), | 50 priority_(priority), |
51 respect_limits_(respect_limits), | 51 respect_limits_(respect_limits), |
52 connect_timeout_duration_(connect_timeout_duration), | 52 connect_timeout_duration_(connect_timeout_duration), |
53 proxy_negotiation_timeout_duration_(proxy_negotiation_timeout_duration), | 53 proxy_negotiation_timeout_duration_(proxy_negotiation_timeout_duration), |
54 transport_pool_(transport_pool), | 54 transport_pool_(transport_pool), |
55 ssl_pool_(ssl_pool), | 55 ssl_pool_(ssl_pool), |
56 transport_params_(transport_params), | 56 transport_params_(transport_params), |
57 ssl_params_(ssl_params), | 57 ssl_params_(ssl_params), |
58 user_agent_(user_agent), | 58 user_agent_(user_agent), |
59 endpoint_(endpoint), | 59 endpoint_(endpoint), |
60 spdy_session_pool_(spdy_session_pool), | 60 spdy_session_pool_(spdy_session_pool), |
61 tunnel_(tunnel), | 61 tunnel_(tunnel), |
62 proxy_delegate_(proxy_delegate), | 62 proxy_delegate_(proxy_delegate), |
63 using_spdy_(false), | 63 using_spdy_(false), |
64 http_auth_controller_( | 64 http_auth_controller_( |
65 tunnel ? new HttpAuthController( | 65 tunnel ? new HttpAuthController( |
66 HttpAuth::AUTH_PROXY, | 66 HttpAuth::AUTH_PROXY, |
67 GURL((ssl_params_.get() ? "https://" : "http://") + | 67 GURL((ssl_params_.get() ? "https://" : "http://") + |
68 GetDestination().host_port_pair().ToString()), | 68 GetDestination().host_port_pair().ToString()), |
69 http_auth_cache, | 69 http_auth_cache, |
70 http_auth_handler_factory) | 70 http_auth_handler_factory) |
71 : nullptr), | 71 : nullptr), |
72 net_log_( | 72 net_log_(NetLogWithSource::Make( |
73 BoundNetLog::Make(net_log.net_log(), | 73 net_log.net_log(), |
74 NetLogSourceType::PROXY_CLIENT_SOCKET_WRAPPER)) { | 74 NetLogSourceType::PROXY_CLIENT_SOCKET_WRAPPER)) { |
75 net_log_.BeginEvent(NetLogEventType::SOCKET_ALIVE, | 75 net_log_.BeginEvent(NetLogEventType::SOCKET_ALIVE, |
76 net_log.source().ToEventParametersCallback()); | 76 net_log.source().ToEventParametersCallback()); |
77 DCHECK(transport_params || ssl_params); | 77 DCHECK(transport_params || ssl_params); |
78 DCHECK(!transport_params || !ssl_params); | 78 DCHECK(!transport_params || !ssl_params); |
79 } | 79 } |
80 | 80 |
81 HttpProxyClientSocketWrapper::~HttpProxyClientSocketWrapper() { | 81 HttpProxyClientSocketWrapper::~HttpProxyClientSocketWrapper() { |
82 // Make sure no sockets are returned to the lower level socket pools. | 82 // Make sure no sockets are returned to the lower level socket pools. |
83 Disconnect(); | 83 Disconnect(); |
84 | 84 |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 // way. | 200 // way. |
201 return false; | 201 return false; |
202 } | 202 } |
203 | 203 |
204 bool HttpProxyClientSocketWrapper::IsConnectedAndIdle() const { | 204 bool HttpProxyClientSocketWrapper::IsConnectedAndIdle() const { |
205 if (transport_socket_) | 205 if (transport_socket_) |
206 return transport_socket_->IsConnectedAndIdle(); | 206 return transport_socket_->IsConnectedAndIdle(); |
207 return false; | 207 return false; |
208 } | 208 } |
209 | 209 |
210 const BoundNetLog& HttpProxyClientSocketWrapper::NetLog() const { | 210 const NetLogWithSource& HttpProxyClientSocketWrapper::NetLog() const { |
211 return net_log_; | 211 return net_log_; |
212 } | 212 } |
213 | 213 |
214 void HttpProxyClientSocketWrapper::SetSubresourceSpeculation() { | 214 void HttpProxyClientSocketWrapper::SetSubresourceSpeculation() { |
215 // This flag isn't passed to reconnected sockets, as only the first connection | 215 // This flag isn't passed to reconnected sockets, as only the first connection |
216 // can be a preconnect. | 216 // can be a preconnect. |
217 if (transport_socket_) | 217 if (transport_socket_) |
218 transport_socket_->SetSubresourceSpeculation(); | 218 transport_socket_->SetSubresourceSpeculation(); |
219 } | 219 } |
220 | 220 |
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
623 const HostResolver::RequestInfo& | 623 const HostResolver::RequestInfo& |
624 HttpProxyClientSocketWrapper::GetDestination() { | 624 HttpProxyClientSocketWrapper::GetDestination() { |
625 if (transport_params_) { | 625 if (transport_params_) { |
626 return transport_params_->destination(); | 626 return transport_params_->destination(); |
627 } else { | 627 } else { |
628 return ssl_params_->GetDirectConnectionParams()->destination(); | 628 return ssl_params_->GetDirectConnectionParams()->destination(); |
629 } | 629 } |
630 } | 630 } |
631 | 631 |
632 } // namespace net | 632 } // namespace net |
OLD | NEW |