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/connect_response_http_stream.h" | |
14 #include "net/http/http_network_session.h" | 15 #include "net/http/http_network_session.h" |
15 #include "net/http/http_proxy_client_socket.h" | 16 #include "net/http/http_proxy_client_socket.h" |
17 #include "net/http/http_response_headers.h" | |
16 #include "net/socket/client_socket_factory.h" | 18 #include "net/socket/client_socket_factory.h" |
17 #include "net/socket/client_socket_handle.h" | 19 #include "net/socket/client_socket_handle.h" |
18 #include "net/socket/client_socket_pool_base.h" | 20 #include "net/socket/client_socket_pool_base.h" |
19 #include "net/socket/ssl_client_socket.h" | 21 #include "net/socket/ssl_client_socket.h" |
20 #include "net/socket/ssl_client_socket_pool.h" | 22 #include "net/socket/ssl_client_socket_pool.h" |
21 #include "net/socket/tcp_client_socket_pool.h" | 23 #include "net/socket/tcp_client_socket_pool.h" |
24 #include "net/spdy/spdy_http_stream.h" | |
22 #include "net/spdy/spdy_proxy_client_socket.h" | 25 #include "net/spdy/spdy_proxy_client_socket.h" |
23 #include "net/spdy/spdy_session.h" | 26 #include "net/spdy/spdy_session.h" |
24 #include "net/spdy/spdy_session_pool.h" | 27 #include "net/spdy/spdy_session_pool.h" |
25 #include "net/spdy/spdy_settings_storage.h" | 28 #include "net/spdy/spdy_settings_storage.h" |
26 #include "net/spdy/spdy_stream.h" | 29 #include "net/spdy/spdy_stream.h" |
27 | 30 |
28 namespace net { | 31 namespace net { |
29 | 32 |
30 HttpProxySocketParams::HttpProxySocketParams( | 33 HttpProxySocketParams::HttpProxySocketParams( |
31 const scoped_refptr<TCPSocketParams>& tcp_params, | 34 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; | 248 next_state_ = STATE_SPDY_PROXY_CREATE_STREAM; |
246 else | 249 else |
247 next_state_ = STATE_HTTP_PROXY_CONNECT; | 250 next_state_ = STATE_HTTP_PROXY_CONNECT; |
248 return result; | 251 return result; |
249 } | 252 } |
250 | 253 |
251 void HttpProxyConnectJob::GetAdditionalErrorState(ClientSocketHandle * handle) { | 254 void HttpProxyConnectJob::GetAdditionalErrorState(ClientSocketHandle * handle) { |
252 if (error_response_info_.cert_request_info) { | 255 if (error_response_info_.cert_request_info) { |
253 handle->set_ssl_error_response_info(error_response_info_); | 256 handle->set_ssl_error_response_info(error_response_info_); |
254 handle->set_is_ssl_error(true); | 257 handle->set_is_ssl_error(true); |
258 } else if (error_response_info_.headers) { | |
259 handle->set_ssl_error_response_info(error_response_info_); | |
vandebo (ex-Chrome)
2010/12/04 00:30:37
Do you need to set this in this case?
Ryan Hamilton
2010/12/09 21:19:35
Yes, definitely. This is how the response headers
| |
260 handle->set_pending_https_proxy_response_stream( | |
261 pending_https_proxy_response_stream_.release()); | |
255 } | 262 } |
256 } | 263 } |
257 | 264 |
258 int HttpProxyConnectJob::DoSpdyProxyCreateStream() { | 265 int HttpProxyConnectJob::DoSpdyProxyCreateStream() { |
259 DCHECK(using_spdy_); | 266 DCHECK(using_spdy_); |
260 DCHECK(params_->tunnel()); | 267 DCHECK(params_->tunnel()); |
261 | 268 |
262 HostPortProxyPair pair(params_->destination().host_port_pair(), | 269 HostPortProxyPair pair(params_->destination().host_port_pair(), |
263 ProxyServer::Direct()); | 270 ProxyServer::Direct()); |
264 SpdySessionPool* spdy_pool = params_->spdy_session_pool(); | 271 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. | 317 // Add a HttpProxy connection on top of the tcp socket. |
311 transport_socket_.reset( | 318 transport_socket_.reset( |
312 new HttpProxyClientSocket(transport_socket_handle_.release(), | 319 new HttpProxyClientSocket(transport_socket_handle_.release(), |
313 params_->request_url(), | 320 params_->request_url(), |
314 params_->user_agent(), | 321 params_->user_agent(), |
315 params_->endpoint(), | 322 params_->endpoint(), |
316 proxy_server, | 323 proxy_server, |
317 params_->http_auth_cache(), | 324 params_->http_auth_cache(), |
318 params_->http_auth_handler_factory(), | 325 params_->http_auth_handler_factory(), |
319 params_->tunnel(), | 326 params_->tunnel(), |
320 using_spdy_)); | 327 using_spdy_, |
328 params_->ssl_params() != NULL)); | |
321 return transport_socket_->Connect(&callback_); | 329 return transport_socket_->Connect(&callback_); |
322 } | 330 } |
323 | 331 |
324 int HttpProxyConnectJob::DoHttpProxyConnectComplete(int result) { | 332 int HttpProxyConnectJob::DoHttpProxyConnectComplete(int result) { |
325 if (result == OK || result == ERR_PROXY_AUTH_REQUESTED) | 333 if (result == OK || result == ERR_PROXY_AUTH_REQUESTED) { |
326 set_socket(transport_socket_.release()); | 334 set_socket(transport_socket_.release()); |
335 } else if (result == ERR_HTTPS_PROXY_TUNNEL_CONNECTION_RESPONSE) { | |
336 error_response_info_ = *transport_socket_->GetConnectResponseInfo(); | |
vandebo (ex-Chrome)
2010/12/04 00:30:37
Now that you've created the HttpProxyTunnelClientS
Ryan Hamilton
2010/12/09 21:19:35
Hm. You're recommending that we pass up the socke
vandebo (ex-Chrome)
2010/12/11 02:47:49
Please look at the ownership issues. Sounds like
Ryan Hamilton
2010/12/13 19:41:12
Done.
| |
337 pending_https_proxy_response_stream_.reset( | |
338 transport_socket_->GetConnectResponseStream()); | |
339 DCHECK(!error_response_info_.cert_request_info.get()); | |
340 set_socket(transport_socket_.release()); | |
vandebo (ex-Chrome)
2010/12/04 00:30:37
Since you are making this a "recoverable error" (b
Ryan Hamilton
2010/12/09 21:19:35
Hm. It took me a while to understand the implicat
| |
341 } | |
327 | 342 |
328 return result; | 343 return result; |
329 } | 344 } |
330 | 345 |
331 HttpProxyClientSocketPool:: | 346 HttpProxyClientSocketPool:: |
332 HttpProxyConnectJobFactory::HttpProxyConnectJobFactory( | 347 HttpProxyConnectJobFactory::HttpProxyConnectJobFactory( |
333 TCPClientSocketPool* tcp_pool, | 348 TCPClientSocketPool* tcp_pool, |
334 SSLClientSocketPool* ssl_pool, | 349 SSLClientSocketPool* ssl_pool, |
335 HostResolver* host_resolver, | 350 HostResolver* host_resolver, |
336 NetLog* net_log) | 351 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", | 462 list->Append(ssl_pool_->GetInfoAsValue("ssl_socket_pool", |
448 "ssl_socket_pool", | 463 "ssl_socket_pool", |
449 true)); | 464 true)); |
450 } | 465 } |
451 dict->Set("nested_pools", list); | 466 dict->Set("nested_pools", list); |
452 } | 467 } |
453 return dict; | 468 return dict; |
454 } | 469 } |
455 | 470 |
456 } // namespace net | 471 } // namespace net |
OLD | NEW |