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

Unified Diff: net/spdy/spdy_proxy_client_socket.cc

Issue 1391053002: [net/http auth] Make HttpAuthHandler challenge handling asynchronous. Base URL: https://chromium.googlesource.com/chromium/src.git@auth-handler-init-split
Patch Set: Created 5 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/spdy/spdy_proxy_client_socket.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/spdy/spdy_proxy_client_socket.cc
diff --git a/net/spdy/spdy_proxy_client_socket.cc b/net/spdy/spdy_proxy_client_socket.cc
index e6d521e1356d7cca7fc58b01afddac3727b560b1..b8e2a9b4d491c56da7c1908cec049ff3d7b3ed92 100644
--- a/net/spdy/spdy_proxy_client_socket.cc
+++ b/net/spdy/spdy_proxy_client_socket.cc
@@ -323,6 +323,12 @@ int SpdyProxyClientSocket::DoLoop(int last_io_result) {
net_log_.EndEventWithNetErrorCode(
NetLog::TYPE_HTTP_TRANSACTION_TUNNEL_READ_HEADERS, rv);
break;
+ case STATE_HANDLE_PROXY_AUTH_CHALLENGE:
+ rv = DoHandleProxyAuthChallenge();
+ break;
+ case STATE_HANDLE_PROXY_AUTH_CHALLENGE_COMPLETE:
+ rv = DoHandleProxyAuthChallengeComplete(rv);
+ break;
default:
NOTREACHED() << "bad state";
rv = ERR_UNEXPECTED;
@@ -420,12 +426,8 @@ int SpdyProxyClientSocket::DoReadReplyComplete(int result) {
return ERR_HTTPS_PROXY_TUNNEL_RESPONSE;
case 407: // Proxy Authentication Required
- next_state_ = STATE_OPEN;
- if (!SanitizeProxyAuth(&response_)) {
- LogBlockedTunnelResponse();
- return ERR_TUNNEL_CONNECTION_FAILED;
- }
- return HandleProxyAuthChallenge(auth_.get(), &response_, net_log_);
+ next_state_ = STATE_HANDLE_PROXY_AUTH_CHALLENGE;
+ return OK;
default:
// Ignore response to avoid letting the proxy impersonate the target
@@ -435,6 +437,29 @@ int SpdyProxyClientSocket::DoReadReplyComplete(int result) {
}
}
+int SpdyProxyClientSocket::DoHandleProxyAuthChallenge() {
+ if (!SanitizeProxyAuth(&response_)) {
+ LogBlockedTunnelResponse();
+ return ERR_TUNNEL_CONNECTION_FAILED;
+ }
+ next_state_ = STATE_HANDLE_PROXY_AUTH_CHALLENGE_COMPLETE;
+ return auth_->HandleAuthChallenge(
+ response_, base::Bind(&SpdyProxyClientSocket::OnIOComplete,
+ weak_factory_.GetWeakPtr()),
+ net_log_);
+}
+
+int SpdyProxyClientSocket::DoHandleProxyAuthChallengeComplete(int result) {
+ next_state_ = STATE_OPEN;
+ if (result != OK)
+ return result;
+ if (auth_->HaveAuthHandler()) {
+ response_.auth_challenge = auth_->auth_info();
+ return ERR_PROXY_AUTH_REQUESTED;
+ }
+ return ERR_PROXY_AUTH_UNSUPPORTED;
+}
+
// SpdyStream::Delegate methods:
// Called when SYN frame has been sent.
// Returns true if no more data to be sent after SYN frame.
« no previous file with comments | « net/spdy/spdy_proxy_client_socket.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698