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

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

Issue 1580903002: Convert ignore_limits from a SocketParam to a socket request argument. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: RespectLimits Created 4 years, 10 months 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_wrapper.h" 5 #include "net/http/http_proxy_client_socket_wrapper.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 11 matching lines...) Expand all
22 #include "net/spdy/spdy_session_pool.h" 22 #include "net/spdy/spdy_session_pool.h"
23 #include "net/spdy/spdy_stream.h" 23 #include "net/spdy/spdy_stream.h"
24 #include "net/ssl/ssl_cert_request_info.h" 24 #include "net/ssl/ssl_cert_request_info.h"
25 #include "url/gurl.h" 25 #include "url/gurl.h"
26 26
27 namespace net { 27 namespace net {
28 28
29 HttpProxyClientSocketWrapper::HttpProxyClientSocketWrapper( 29 HttpProxyClientSocketWrapper::HttpProxyClientSocketWrapper(
30 const std::string& group_name, 30 const std::string& group_name,
31 RequestPriority priority, 31 RequestPriority priority,
32 ClientSocketPool::RespectLimits respect_limits,
32 base::TimeDelta connect_timeout_duration, 33 base::TimeDelta connect_timeout_duration,
33 base::TimeDelta proxy_negotiation_timeout_duration, 34 base::TimeDelta proxy_negotiation_timeout_duration,
34 TransportClientSocketPool* transport_pool, 35 TransportClientSocketPool* transport_pool,
35 SSLClientSocketPool* ssl_pool, 36 SSLClientSocketPool* ssl_pool,
36 const scoped_refptr<TransportSocketParams>& transport_params, 37 const scoped_refptr<TransportSocketParams>& transport_params,
37 const scoped_refptr<SSLSocketParams>& ssl_params, 38 const scoped_refptr<SSLSocketParams>& ssl_params,
38 const std::string& user_agent, 39 const std::string& user_agent,
39 const HostPortPair& endpoint, 40 const HostPortPair& endpoint,
40 HttpAuthCache* http_auth_cache, 41 HttpAuthCache* http_auth_cache,
41 HttpAuthHandlerFactory* http_auth_handler_factory, 42 HttpAuthHandlerFactory* http_auth_handler_factory,
42 SpdySessionPool* spdy_session_pool, 43 SpdySessionPool* spdy_session_pool,
43 bool tunnel, 44 bool tunnel,
44 ProxyDelegate* proxy_delegate, 45 ProxyDelegate* proxy_delegate,
45 const BoundNetLog& net_log) 46 const BoundNetLog& net_log)
46 : next_state_(STATE_NONE), 47 : next_state_(STATE_NONE),
47 group_name_(group_name), 48 group_name_(group_name),
48 priority_(priority), 49 priority_(priority),
50 respect_limits_(respect_limits),
49 connect_timeout_duration_(connect_timeout_duration), 51 connect_timeout_duration_(connect_timeout_duration),
50 proxy_negotiation_timeout_duration_(proxy_negotiation_timeout_duration), 52 proxy_negotiation_timeout_duration_(proxy_negotiation_timeout_duration),
51 transport_pool_(transport_pool), 53 transport_pool_(transport_pool),
52 ssl_pool_(ssl_pool), 54 ssl_pool_(ssl_pool),
53 transport_params_(transport_params), 55 transport_params_(transport_params),
54 ssl_params_(ssl_params), 56 ssl_params_(ssl_params),
55 user_agent_(user_agent), 57 user_agent_(user_agent),
56 endpoint_(endpoint), 58 endpoint_(endpoint),
57 http_auth_cache_(http_auth_cache), 59 http_auth_cache_(http_auth_cache),
58 http_auth_handler_factory_(http_auth_handler_factory), 60 http_auth_handler_factory_(http_auth_handler_factory),
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 next_state_ = STATE_SSL_CONNECT; 399 next_state_ = STATE_SSL_CONNECT;
398 } 400 }
399 401
400 return OK; 402 return OK;
401 } 403 }
402 404
403 int HttpProxyClientSocketWrapper::DoTransportConnect() { 405 int HttpProxyClientSocketWrapper::DoTransportConnect() {
404 next_state_ = STATE_TCP_CONNECT_COMPLETE; 406 next_state_ = STATE_TCP_CONNECT_COMPLETE;
405 transport_socket_handle_.reset(new ClientSocketHandle()); 407 transport_socket_handle_.reset(new ClientSocketHandle());
406 return transport_socket_handle_->Init( 408 return transport_socket_handle_->Init(
407 group_name_, transport_params_, priority_, 409 group_name_, transport_params_, priority_, respect_limits_,
408 base::Bind(&HttpProxyClientSocketWrapper::OnIOComplete, 410 base::Bind(&HttpProxyClientSocketWrapper::OnIOComplete,
409 base::Unretained(this)), 411 base::Unretained(this)),
410 transport_pool_, net_log_); 412 transport_pool_, net_log_);
411 } 413 }
412 414
413 int HttpProxyClientSocketWrapper::DoTransportConnectComplete(int result) { 415 int HttpProxyClientSocketWrapper::DoTransportConnectComplete(int result) {
414 if (result != OK) 416 if (result != OK)
415 return ERR_PROXY_CONNECTION_FAILED; 417 return ERR_PROXY_CONNECTION_FAILED;
416 418
417 // Reset the timer to just the length of time allowed for HttpProxy handshake 419 // Reset the timer to just the length of time allowed for HttpProxy handshake
(...skipping 11 matching lines...) Expand all
429 PRIVACY_MODE_DISABLED); 431 PRIVACY_MODE_DISABLED);
430 if (spdy_session_pool_->FindAvailableSession(key, net_log_)) { 432 if (spdy_session_pool_->FindAvailableSession(key, net_log_)) {
431 using_spdy_ = true; 433 using_spdy_ = true;
432 next_state_ = STATE_SPDY_PROXY_CREATE_STREAM; 434 next_state_ = STATE_SPDY_PROXY_CREATE_STREAM;
433 return OK; 435 return OK;
434 } 436 }
435 } 437 }
436 next_state_ = STATE_SSL_CONNECT_COMPLETE; 438 next_state_ = STATE_SSL_CONNECT_COMPLETE;
437 transport_socket_handle_.reset(new ClientSocketHandle()); 439 transport_socket_handle_.reset(new ClientSocketHandle());
438 return transport_socket_handle_->Init( 440 return transport_socket_handle_->Init(
439 group_name_, ssl_params_, priority_, 441 group_name_, ssl_params_, priority_, respect_limits_,
440 base::Bind(&HttpProxyClientSocketWrapper::OnIOComplete, 442 base::Bind(&HttpProxyClientSocketWrapper::OnIOComplete,
441 base::Unretained(this)), 443 base::Unretained(this)),
442 ssl_pool_, net_log_); 444 ssl_pool_, net_log_);
443 } 445 }
444 446
445 int HttpProxyClientSocketWrapper::DoSSLConnectComplete(int result) { 447 int HttpProxyClientSocketWrapper::DoSSLConnectComplete(int result) {
446 if (result == ERR_SSL_CLIENT_AUTH_CERT_NEEDED) { 448 if (result == ERR_SSL_CLIENT_AUTH_CERT_NEEDED) {
447 DCHECK( 449 DCHECK(
448 transport_socket_handle_->ssl_error_response_info().cert_request_info); 450 transport_socket_handle_->ssl_error_response_info().cert_request_info);
449 error_response_info_.reset(new HttpResponseInfo( 451 error_response_info_.reset(new HttpResponseInfo(
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
580 // error on to caller, even if the credentials may have passed a close message 582 // error on to caller, even if the credentials may have passed a close message
581 // from the server in flight. 583 // from the server in flight.
582 if (result == ERR_UNABLE_TO_REUSE_CONNECTION_FOR_PROXY_AUTH) { 584 if (result == ERR_UNABLE_TO_REUSE_CONNECTION_FOR_PROXY_AUTH) {
583 // If can't reuse the connection, attempt to create a new one. 585 // If can't reuse the connection, attempt to create a new one.
584 transport_socket_.reset(); 586 transport_socket_.reset();
585 // Reconnect with HIGHEST priority to get in front of other requests that 587 // Reconnect with HIGHEST priority to get in front of other requests that
586 // don't yet have the information |http_auth_controller_| does. 588 // don't yet have the information |http_auth_controller_| does.
587 // TODO(mmenke): This may still result in waiting in line, if there are 589 // TODO(mmenke): This may still result in waiting in line, if there are
588 // other HIGHEST priority requests. Consider a workaround for 590 // other HIGHEST priority requests. Consider a workaround for
589 // that. Starting the new request before releasing the old 591 // that. Starting the new request before releasing the old
590 // socket and using LOAD_IGNORE_LIMITS would do the trick, 592 // socket and using RespectLimits::Disabled would work,
591 // without exceding the the socket pool limits (Since the old 593 // without exceding the the socket pool limits (Since the old
592 // socket would free up the extra socket slot when destroyed). 594 // socket would free up the extra socket slot when destroyed).
593 priority_ = HIGHEST; 595 priority_ = HIGHEST;
594 next_state_ = STATE_BEGIN_CONNECT; 596 next_state_ = STATE_BEGIN_CONNECT;
595 return OK; 597 return OK;
596 } 598 }
597 599
598 return result; 600 return result;
599 } 601 }
600 602
(...skipping 26 matching lines...) Expand all
627 const HostResolver::RequestInfo& 629 const HostResolver::RequestInfo&
628 HttpProxyClientSocketWrapper::GetDestination() { 630 HttpProxyClientSocketWrapper::GetDestination() {
629 if (transport_params_) { 631 if (transport_params_) {
630 return transport_params_->destination(); 632 return transport_params_->destination();
631 } else { 633 } else {
632 return ssl_params_->GetDirectConnectionParams()->destination(); 634 return ssl_params_->GetDirectConnectionParams()->destination();
633 } 635 }
634 } 636 }
635 637
636 } // namespace net 638 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_proxy_client_socket_wrapper.h ('k') | net/http/http_stream_factory_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698