Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(291)

Side by Side Diff: net/http/http_proxy_client_socket_pool.cc

Issue 4935001: Allow a non-200 (or non-407) response for a CONNECT request from an HTTPS pro... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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_);
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
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();
337 pending_https_proxy_response_stream_.reset(
338 transport_socket_->GetConnectResponseStream());
339 DCHECK(!error_response_info_.cert_request_info.get());
340 }
327 341
328 return result; 342 return result;
329 } 343 }
330 344
331 HttpProxyClientSocketPool:: 345 HttpProxyClientSocketPool::
332 HttpProxyConnectJobFactory::HttpProxyConnectJobFactory( 346 HttpProxyConnectJobFactory::HttpProxyConnectJobFactory(
333 TCPClientSocketPool* tcp_pool, 347 TCPClientSocketPool* tcp_pool,
334 SSLClientSocketPool* ssl_pool, 348 SSLClientSocketPool* ssl_pool,
335 HostResolver* host_resolver, 349 HostResolver* host_resolver,
336 NetLog* net_log) 350 NetLog* net_log)
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 list->Append(ssl_pool_->GetInfoAsValue("ssl_socket_pool", 461 list->Append(ssl_pool_->GetInfoAsValue("ssl_socket_pool",
448 "ssl_socket_pool", 462 "ssl_socket_pool",
449 true)); 463 true));
450 } 464 }
451 dict->Set("nested_pools", list); 465 dict->Set("nested_pools", list);
452 } 466 }
453 return dict; 467 return dict;
454 } 468 }
455 469
456 } // namespace net 470 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698