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_https_proxy_tunnel_response_socket( |
| 260 https_proxy_tunnel_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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 // Add a HttpProxy connection on top of the tcp socket. | 317 // Add a HttpProxy connection on top of the tcp socket. |
312 transport_socket_.reset( | 318 transport_socket_.reset( |
313 new HttpProxyClientSocket(transport_socket_handle_.release(), | 319 new HttpProxyClientSocket(transport_socket_handle_.release(), |
314 params_->request_url(), | 320 params_->request_url(), |
315 params_->user_agent(), | 321 params_->user_agent(), |
316 params_->endpoint(), | 322 params_->endpoint(), |
317 proxy_server, | 323 proxy_server, |
318 params_->http_auth_cache(), | 324 params_->http_auth_cache(), |
319 params_->http_auth_handler_factory(), | 325 params_->http_auth_handler_factory(), |
320 params_->tunnel(), | 326 params_->tunnel(), |
321 using_spdy_)); | 327 using_spdy_, |
| 328 params_->ssl_params() != NULL)); |
322 return transport_socket_->Connect(&callback_); | 329 return transport_socket_->Connect(&callback_); |
323 } | 330 } |
324 | 331 |
325 int HttpProxyConnectJob::DoHttpProxyConnectComplete(int result) { | 332 int HttpProxyConnectJob::DoHttpProxyConnectComplete(int result) { |
326 if (result == OK || result == ERR_PROXY_AUTH_REQUESTED) | 333 if (result == OK || result == ERR_PROXY_AUTH_REQUESTED) { |
327 set_socket(transport_socket_.release()); | 334 set_socket(transport_socket_.release()); |
| 335 } else if (result == ERR_HTTPS_PROXY_TUNNEL_RESPONSE) { |
| 336 error_response_info_ = *transport_socket_->GetConnectResponseInfo(); |
| 337 https_proxy_tunnel_response_socket_.reset(transport_socket_.release()); |
| 338 DCHECK(!error_response_info_.cert_request_info.get()); |
| 339 } |
328 | 340 |
329 return result; | 341 return result; |
330 } | 342 } |
331 | 343 |
332 HttpProxyClientSocketPool:: | 344 HttpProxyClientSocketPool:: |
333 HttpProxyConnectJobFactory::HttpProxyConnectJobFactory( | 345 HttpProxyConnectJobFactory::HttpProxyConnectJobFactory( |
334 TCPClientSocketPool* tcp_pool, | 346 TCPClientSocketPool* tcp_pool, |
335 SSLClientSocketPool* ssl_pool, | 347 SSLClientSocketPool* ssl_pool, |
336 HostResolver* host_resolver, | 348 HostResolver* host_resolver, |
337 NetLog* net_log) | 349 NetLog* net_log) |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 list->Append(ssl_pool_->GetInfoAsValue("ssl_socket_pool", | 460 list->Append(ssl_pool_->GetInfoAsValue("ssl_socket_pool", |
449 "ssl_socket_pool", | 461 "ssl_socket_pool", |
450 true)); | 462 true)); |
451 } | 463 } |
452 dict->Set("nested_pools", list); | 464 dict->Set("nested_pools", list); |
453 } | 465 } |
454 return dict; | 466 return dict; |
455 } | 467 } |
456 | 468 |
457 } // namespace net | 469 } // namespace net |
OLD | NEW |