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

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

Issue 2688173002: Don't rely on SSL cipher fallback in proxy auth. (Closed)
Patch Set: Created 3 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
« no previous file with comments | « net/http/http_proxy_client_socket_wrapper.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 respect_limits_(respect_limits), 52 respect_limits_(respect_limits),
53 connect_timeout_duration_(connect_timeout_duration), 53 connect_timeout_duration_(connect_timeout_duration),
54 proxy_negotiation_timeout_duration_(proxy_negotiation_timeout_duration), 54 proxy_negotiation_timeout_duration_(proxy_negotiation_timeout_duration),
55 transport_pool_(transport_pool), 55 transport_pool_(transport_pool),
56 ssl_pool_(ssl_pool), 56 ssl_pool_(ssl_pool),
57 transport_params_(transport_params), 57 transport_params_(transport_params),
58 ssl_params_(ssl_params), 58 ssl_params_(ssl_params),
59 user_agent_(user_agent), 59 user_agent_(user_agent),
60 endpoint_(endpoint), 60 endpoint_(endpoint),
61 spdy_session_pool_(spdy_session_pool), 61 spdy_session_pool_(spdy_session_pool),
62 has_restarted_(false),
62 tunnel_(tunnel), 63 tunnel_(tunnel),
63 proxy_delegate_(proxy_delegate), 64 proxy_delegate_(proxy_delegate),
64 using_spdy_(false), 65 using_spdy_(false),
65 http_auth_controller_( 66 http_auth_controller_(
66 tunnel ? new HttpAuthController( 67 tunnel ? new HttpAuthController(
67 HttpAuth::AUTH_PROXY, 68 HttpAuth::AUTH_PROXY,
68 GURL((ssl_params_.get() ? "https://" : "http://") + 69 GURL((ssl_params_.get() ? "https://" : "http://") +
69 GetDestination().host_port_pair().ToString()), 70 GetDestination().host_port_pair().ToString()),
70 http_auth_cache, 71 http_auth_cache,
71 http_auth_handler_factory) 72 http_auth_handler_factory)
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after
565 int HttpProxyClientSocketWrapper::DoRestartWithAuth() { 566 int HttpProxyClientSocketWrapper::DoRestartWithAuth() {
566 DCHECK(transport_socket_); 567 DCHECK(transport_socket_);
567 568
568 next_state_ = STATE_RESTART_WITH_AUTH_COMPLETE; 569 next_state_ = STATE_RESTART_WITH_AUTH_COMPLETE;
569 return transport_socket_->RestartWithAuth(base::Bind( 570 return transport_socket_->RestartWithAuth(base::Bind(
570 &HttpProxyClientSocketWrapper::OnIOComplete, base::Unretained(this))); 571 &HttpProxyClientSocketWrapper::OnIOComplete, base::Unretained(this)));
571 } 572 }
572 573
573 int HttpProxyClientSocketWrapper::DoRestartWithAuthComplete(int result) { 574 int HttpProxyClientSocketWrapper::DoRestartWithAuthComplete(int result) {
574 DCHECK_NE(ERR_IO_PENDING, result); 575 DCHECK_NE(ERR_IO_PENDING, result);
576
575 // If the connection could not be reused to attempt to send proxy auth 577 // If the connection could not be reused to attempt to send proxy auth
576 // credentials, try reconnecting. If auth credentials were sent, pass the 578 // credentials, try reconnecting. Do not reset the HttpAuthController in this
577 // error on to caller, even if the credentials may have passed a close message 579 // case; the server may, for instance, send "Proxy-Connection: close" and
578 // from the server in flight. 580 // expect that each leg of the authentication progress on separate
579 if (result == ERR_UNABLE_TO_REUSE_CONNECTION_FOR_PROXY_AUTH) { 581 // connections.
580 // If can't reuse the connection, attempt to create a new one. 582 bool reconnect = result == ERR_UNABLE_TO_REUSE_CONNECTION_FOR_PROXY_AUTH;
583
584 // If auth credentials were sent but the connection was closed, the server may
585 // have timed out while the user was selecting credentials. Retry once.
586 if (!has_restarted_ &&
587 (result == ERR_CONNECTION_CLOSED || result == ERR_CONNECTION_RESET ||
588 result == ERR_CONNECTION_ABORTED ||
589 result == ERR_SOCKET_NOT_CONNECTED)) {
590 reconnect = true;
591 has_restarted_ = true;
592
593 // Release any auth state bound to the connection. The new connection will
594 // start the current scheme from scratch.
595 if (http_auth_controller_)
596 http_auth_controller_->OnConnectionClosed();
asanka 2017/03/02 22:38:52 The one case I can think of where this assumption
davidben 2017/04/07 18:11:46 I'm confused. I thought this was the case this cod
asanka 2017/04/12 23:02:32 Yeah, I'm okay with landing this and fixing the cr
597 }
598
599 if (reconnect) {
600 // Attempt to create a new one.
581 transport_socket_.reset(); 601 transport_socket_.reset();
602
582 // Reconnect with HIGHEST priority to get in front of other requests that 603 // Reconnect with HIGHEST priority to get in front of other requests that
583 // don't yet have the information |http_auth_controller_| does. 604 // don't yet have the information |http_auth_controller_| does.
584 // TODO(mmenke): This may still result in waiting in line, if there are 605 // TODO(mmenke): This may still result in waiting in line, if there are
585 // other HIGHEST priority requests. Consider a workaround for 606 // other HIGHEST priority requests. Consider a workaround for
586 // that. Starting the new request before releasing the old 607 // that. Starting the new request before releasing the old
587 // socket and using RespectLimits::Disabled would work, 608 // socket and using RespectLimits::Disabled would work,
588 // without exceding the the socket pool limits (Since the old 609 // without exceding the the socket pool limits (Since the old
589 // socket would free up the extra socket slot when destroyed). 610 // socket would free up the extra socket slot when destroyed).
590 priority_ = HIGHEST; 611 priority_ = HIGHEST;
591 next_state_ = STATE_BEGIN_CONNECT; 612 next_state_ = STATE_BEGIN_CONNECT;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
624 const HostResolver::RequestInfo& 645 const HostResolver::RequestInfo&
625 HttpProxyClientSocketWrapper::GetDestination() { 646 HttpProxyClientSocketWrapper::GetDestination() {
626 if (transport_params_) { 647 if (transport_params_) {
627 return transport_params_->destination(); 648 return transport_params_->destination();
628 } else { 649 } else {
629 return ssl_params_->GetDirectConnectionParams()->destination(); 650 return ssl_params_->GetDirectConnectionParams()->destination();
630 } 651 }
631 } 652 }
632 653
633 } // namespace net 654 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_proxy_client_socket_wrapper.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698