Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/time.h" | 9 #include "base/time.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| 11 #include "googleurl/src/gurl.h" | 11 #include "googleurl/src/gurl.h" |
| 12 #include "net/base/load_flags.h" | 12 #include "net/base/load_flags.h" |
| 13 #include "net/base/net_errors.h" | 13 #include "net/base/net_errors.h" |
| 14 #include "net/http/http_network_session.h" | 14 #include "net/http/http_network_session.h" |
| 15 #include "net/http/http_proxy_client_socket.h" | 15 #include "net/http/http_proxy_client_socket.h" |
| 16 #include "net/http/http_response_headers.h" | |
| 16 #include "net/socket/client_socket_factory.h" | 17 #include "net/socket/client_socket_factory.h" |
| 17 #include "net/socket/client_socket_handle.h" | 18 #include "net/socket/client_socket_handle.h" |
| 18 #include "net/socket/client_socket_pool_base.h" | 19 #include "net/socket/client_socket_pool_base.h" |
| 19 #include "net/socket/ssl_client_socket.h" | 20 #include "net/socket/ssl_client_socket.h" |
| 20 #include "net/socket/ssl_client_socket_pool.h" | 21 #include "net/socket/ssl_client_socket_pool.h" |
| 21 #include "net/socket/tcp_client_socket_pool.h" | 22 #include "net/socket/tcp_client_socket_pool.h" |
| 23 #include "net/spdy/spdy_http_stream.h" | |
| 22 #include "net/spdy/spdy_proxy_client_socket.h" | 24 #include "net/spdy/spdy_proxy_client_socket.h" |
| 23 #include "net/spdy/spdy_session.h" | 25 #include "net/spdy/spdy_session.h" |
| 24 #include "net/spdy/spdy_session_pool.h" | 26 #include "net/spdy/spdy_session_pool.h" |
| 25 #include "net/spdy/spdy_settings_storage.h" | 27 #include "net/spdy/spdy_settings_storage.h" |
| 26 #include "net/spdy/spdy_stream.h" | 28 #include "net/spdy/spdy_stream.h" |
| 27 | 29 |
| 28 namespace net { | 30 namespace net { |
| 29 | 31 |
| 30 HttpProxySocketParams::HttpProxySocketParams( | 32 HttpProxySocketParams::HttpProxySocketParams( |
| 31 const scoped_refptr<TCPSocketParams>& tcp_params, | 33 const scoped_refptr<TCPSocketParams>& tcp_params, |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 245 next_state_ = STATE_SPDY_PROXY_CREATE_STREAM; | 247 next_state_ = STATE_SPDY_PROXY_CREATE_STREAM; |
| 246 else | 248 else |
| 247 next_state_ = STATE_HTTP_PROXY_CONNECT; | 249 next_state_ = STATE_HTTP_PROXY_CONNECT; |
| 248 return result; | 250 return result; |
| 249 } | 251 } |
| 250 | 252 |
| 251 void HttpProxyConnectJob::GetAdditionalErrorState(ClientSocketHandle * handle) { | 253 void HttpProxyConnectJob::GetAdditionalErrorState(ClientSocketHandle * handle) { |
| 252 if (error_response_info_.cert_request_info) { | 254 if (error_response_info_.cert_request_info) { |
| 253 handle->set_ssl_error_response_info(error_response_info_); | 255 handle->set_ssl_error_response_info(error_response_info_); |
| 254 handle->set_is_ssl_error(true); | 256 handle->set_is_ssl_error(true); |
| 257 } else if (error_response_info_.headers) { | |
| 258 handle->set_ssl_error_response_info(error_response_info_); | |
| 259 handle->set_pending_https_proxy_response_socket( | |
| 260 pending_https_proxy_response_socket_.release()); | |
| 255 } | 261 } |
| 256 } | 262 } |
| 257 | 263 |
| 258 int HttpProxyConnectJob::DoSpdyProxyCreateStream() { | 264 int HttpProxyConnectJob::DoSpdyProxyCreateStream() { |
| 259 DCHECK(using_spdy_); | 265 DCHECK(using_spdy_); |
| 260 DCHECK(params_->tunnel()); | 266 DCHECK(params_->tunnel()); |
| 261 | 267 |
| 262 HostPortProxyPair pair(params_->destination().host_port_pair(), | 268 HostPortProxyPair pair(params_->destination().host_port_pair(), |
| 263 ProxyServer::Direct()); | 269 ProxyServer::Direct()); |
| 264 SpdySessionPool* spdy_pool = params_->spdy_session_pool(); | 270 SpdySessionPool* spdy_pool = params_->spdy_session_pool(); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 310 // Add a HttpProxy connection on top of the tcp socket. | 316 // Add a HttpProxy connection on top of the tcp socket. |
| 311 transport_socket_.reset( | 317 transport_socket_.reset( |
| 312 new HttpProxyClientSocket(transport_socket_handle_.release(), | 318 new HttpProxyClientSocket(transport_socket_handle_.release(), |
| 313 params_->request_url(), | 319 params_->request_url(), |
| 314 params_->user_agent(), | 320 params_->user_agent(), |
| 315 params_->endpoint(), | 321 params_->endpoint(), |
| 316 proxy_server, | 322 proxy_server, |
| 317 params_->http_auth_cache(), | 323 params_->http_auth_cache(), |
| 318 params_->http_auth_handler_factory(), | 324 params_->http_auth_handler_factory(), |
| 319 params_->tunnel(), | 325 params_->tunnel(), |
| 320 using_spdy_)); | 326 using_spdy_, |
| 327 params_->ssl_params() != NULL)); | |
| 321 return transport_socket_->Connect(&callback_); | 328 return transport_socket_->Connect(&callback_); |
| 322 } | 329 } |
| 323 | 330 |
| 324 int HttpProxyConnectJob::DoHttpProxyConnectComplete(int result) { | 331 int HttpProxyConnectJob::DoHttpProxyConnectComplete(int result) { |
| 325 if (result == OK || result == ERR_PROXY_AUTH_REQUESTED) | 332 if (result == OK || result == ERR_PROXY_AUTH_REQUESTED) { |
| 326 set_socket(transport_socket_.release()); | 333 set_socket(transport_socket_.release()); |
| 334 } else if (result == ERR_HTTPS_PROXY_TUNNEL_CONNECTION_RESPONSE) { | |
| 335 error_response_info_ = *transport_socket_->GetConnectResponseInfo(); | |
|
vandebo (ex-Chrome)
2010/12/14 00:30:23
Urg - it just occurred to me this connection will
Ryan Hamilton
2010/12/15 20:14:17
I'm still not sure that I understand the technical
vandebo (ex-Chrome)
2010/12/15 22:52:38
I think you've got this right. A ClientSocketHand
| |
| 336 pending_https_proxy_response_socket_.reset(transport_socket_.release()); | |
| 337 DCHECK(!error_response_info_.cert_request_info.get()); | |
| 338 } | |
| 327 | 339 |
| 328 return result; | 340 return result; |
| 329 } | 341 } |
| 330 | 342 |
| 331 HttpProxyClientSocketPool:: | 343 HttpProxyClientSocketPool:: |
| 332 HttpProxyConnectJobFactory::HttpProxyConnectJobFactory( | 344 HttpProxyConnectJobFactory::HttpProxyConnectJobFactory( |
| 333 TCPClientSocketPool* tcp_pool, | 345 TCPClientSocketPool* tcp_pool, |
| 334 SSLClientSocketPool* ssl_pool, | 346 SSLClientSocketPool* ssl_pool, |
| 335 HostResolver* host_resolver, | 347 HostResolver* host_resolver, |
| 336 NetLog* net_log) | 348 NetLog* net_log) |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 447 list->Append(ssl_pool_->GetInfoAsValue("ssl_socket_pool", | 459 list->Append(ssl_pool_->GetInfoAsValue("ssl_socket_pool", |
| 448 "ssl_socket_pool", | 460 "ssl_socket_pool", |
| 449 true)); | 461 true)); |
| 450 } | 462 } |
| 451 dict->Set("nested_pools", list); | 463 dict->Set("nested_pools", list); |
| 452 } | 464 } |
| 453 return dict; | 465 return dict; |
| 454 } | 466 } |
| 455 | 467 |
| 456 } // namespace net | 468 } // namespace net |
| OLD | NEW |