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. |