OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_pool.h" | 5 #include "net/http/http_proxy_client_socket_pool.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/time.h" | 10 #include "base/time.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 bool tunnel) | 40 bool tunnel) |
41 : transport_params_(transport_params), | 41 : transport_params_(transport_params), |
42 ssl_params_(ssl_params), | 42 ssl_params_(ssl_params), |
43 spdy_session_pool_(spdy_session_pool), | 43 spdy_session_pool_(spdy_session_pool), |
44 request_url_(request_url), | 44 request_url_(request_url), |
45 user_agent_(user_agent), | 45 user_agent_(user_agent), |
46 endpoint_(endpoint), | 46 endpoint_(endpoint), |
47 http_auth_cache_(tunnel ? http_auth_cache : NULL), | 47 http_auth_cache_(tunnel ? http_auth_cache : NULL), |
48 http_auth_handler_factory_(tunnel ? http_auth_handler_factory : NULL), | 48 http_auth_handler_factory_(tunnel ? http_auth_handler_factory : NULL), |
49 tunnel_(tunnel) { | 49 tunnel_(tunnel) { |
50 DCHECK((transport_params == NULL && ssl_params != NULL) || | 50 DCHECK((transport_params.get() == NULL && ssl_params.get() != NULL) || |
51 (transport_params != NULL && ssl_params == NULL)); | 51 (transport_params.get() != NULL && ssl_params.get() == NULL)); |
52 if (transport_params_) { | 52 if (transport_params_.get()) { |
53 ignore_limits_ = transport_params->ignore_limits(); | 53 ignore_limits_ = transport_params->ignore_limits(); |
54 } else { | 54 } else { |
55 ignore_limits_ = ssl_params->ignore_limits(); | 55 ignore_limits_ = ssl_params->ignore_limits(); |
56 } | 56 } |
57 } | 57 } |
58 | 58 |
59 const HostResolver::RequestInfo& HttpProxySocketParams::destination() const { | 59 const HostResolver::RequestInfo& HttpProxySocketParams::destination() const { |
60 if (transport_params_ == NULL) { | 60 if (transport_params_.get() == NULL) { |
61 return ssl_params_->transport_params()->destination(); | 61 return ssl_params_->transport_params()->destination(); |
62 } else { | 62 } else { |
63 return transport_params_->destination(); | 63 return transport_params_->destination(); |
64 } | 64 } |
65 } | 65 } |
66 | 66 |
67 HttpProxySocketParams::~HttpProxySocketParams() {} | 67 HttpProxySocketParams::~HttpProxySocketParams() {} |
68 | 68 |
69 // HttpProxyConnectJobs will time out after this many seconds. Note this is on | 69 // HttpProxyConnectJobs will time out after this many seconds. Note this is on |
70 // top of the timeout for the transport socket. | 70 // top of the timeout for the transport socket. |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 case STATE_SPDY_PROXY_CREATE_STREAM: | 111 case STATE_SPDY_PROXY_CREATE_STREAM: |
112 case STATE_SPDY_PROXY_CREATE_STREAM_COMPLETE: | 112 case STATE_SPDY_PROXY_CREATE_STREAM_COMPLETE: |
113 return LOAD_STATE_ESTABLISHING_PROXY_TUNNEL; | 113 return LOAD_STATE_ESTABLISHING_PROXY_TUNNEL; |
114 default: | 114 default: |
115 NOTREACHED(); | 115 NOTREACHED(); |
116 return LOAD_STATE_IDLE; | 116 return LOAD_STATE_IDLE; |
117 } | 117 } |
118 } | 118 } |
119 | 119 |
120 void HttpProxyConnectJob::GetAdditionalErrorState(ClientSocketHandle * handle) { | 120 void HttpProxyConnectJob::GetAdditionalErrorState(ClientSocketHandle * handle) { |
121 if (error_response_info_.cert_request_info) { | 121 if (error_response_info_.cert_request_info.get()) { |
122 handle->set_ssl_error_response_info(error_response_info_); | 122 handle->set_ssl_error_response_info(error_response_info_); |
123 handle->set_is_ssl_error(true); | 123 handle->set_is_ssl_error(true); |
124 } | 124 } |
125 } | 125 } |
126 | 126 |
127 void HttpProxyConnectJob::OnIOComplete(int result) { | 127 void HttpProxyConnectJob::OnIOComplete(int result) { |
128 int rv = DoLoop(result); | 128 int rv = DoLoop(result); |
129 if (rv != ERR_IO_PENDING) | 129 if (rv != ERR_IO_PENDING) |
130 NotifyDelegateOfCompletion(rv); // Deletes |this| | 130 NotifyDelegateOfCompletion(rv); // Deletes |this| |
131 } | 131 } |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 new HttpProxyClientSocket(transport_socket_handle_.release(), | 275 new HttpProxyClientSocket(transport_socket_handle_.release(), |
276 params_->request_url(), | 276 params_->request_url(), |
277 params_->user_agent(), | 277 params_->user_agent(), |
278 params_->endpoint(), | 278 params_->endpoint(), |
279 proxy_server, | 279 proxy_server, |
280 params_->http_auth_cache(), | 280 params_->http_auth_cache(), |
281 params_->http_auth_handler_factory(), | 281 params_->http_auth_handler_factory(), |
282 params_->tunnel(), | 282 params_->tunnel(), |
283 using_spdy_, | 283 using_spdy_, |
284 protocol_negotiated_, | 284 protocol_negotiated_, |
285 params_->ssl_params() != NULL)); | 285 params_->ssl_params().get() != NULL)); |
286 return transport_socket_->Connect(callback_); | 286 return transport_socket_->Connect(callback_); |
287 } | 287 } |
288 | 288 |
289 int HttpProxyConnectJob::DoHttpProxyConnectComplete(int result) { | 289 int HttpProxyConnectJob::DoHttpProxyConnectComplete(int result) { |
290 if (result == OK || result == ERR_PROXY_AUTH_REQUESTED || | 290 if (result == OK || result == ERR_PROXY_AUTH_REQUESTED || |
291 result == ERR_HTTPS_PROXY_TUNNEL_RESPONSE) { | 291 result == ERR_HTTPS_PROXY_TUNNEL_RESPONSE) { |
292 set_socket(transport_socket_.release()); | 292 set_socket(transport_socket_.release()); |
293 } | 293 } |
294 | 294 |
295 return result; | 295 return result; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 params_->endpoint(), | 340 params_->endpoint(), |
341 params_->request_url(), | 341 params_->request_url(), |
342 params_->destination().host_port_pair(), | 342 params_->destination().host_port_pair(), |
343 net_log(), | 343 net_log(), |
344 params_->http_auth_cache(), | 344 params_->http_auth_cache(), |
345 params_->http_auth_handler_factory())); | 345 params_->http_auth_handler_factory())); |
346 return transport_socket_->Connect(callback_); | 346 return transport_socket_->Connect(callback_); |
347 } | 347 } |
348 | 348 |
349 int HttpProxyConnectJob::ConnectInternal() { | 349 int HttpProxyConnectJob::ConnectInternal() { |
350 if (params_->transport_params()) { | 350 if (params_->transport_params().get()) { |
351 next_state_ = STATE_TCP_CONNECT; | 351 next_state_ = STATE_TCP_CONNECT; |
352 } else { | 352 } else { |
353 next_state_ = STATE_SSL_CONNECT; | 353 next_state_ = STATE_SSL_CONNECT; |
354 } | 354 } |
355 return DoLoop(OK); | 355 return DoLoop(OK); |
356 } | 356 } |
357 | 357 |
358 HttpProxyClientSocketPool:: | 358 HttpProxyClientSocketPool:: |
359 HttpProxyConnectJobFactory::HttpProxyConnectJobFactory( | 359 HttpProxyConnectJobFactory::HttpProxyConnectJobFactory( |
360 TransportClientSocketPool* transport_pool, | 360 TransportClientSocketPool* transport_pool, |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
532 return base_.histograms(); | 532 return base_.histograms(); |
533 } | 533 } |
534 | 534 |
535 bool HttpProxyClientSocketPool::CloseOneIdleConnection() { | 535 bool HttpProxyClientSocketPool::CloseOneIdleConnection() { |
536 if (base_.CloseOneIdleSocket()) | 536 if (base_.CloseOneIdleSocket()) |
537 return true; | 537 return true; |
538 return base_.CloseOneIdleConnectionInLayeredPool(); | 538 return base_.CloseOneIdleConnectionInLayeredPool(); |
539 } | 539 } |
540 | 540 |
541 } // namespace net | 541 } // namespace net |
OLD | NEW |