| Index: net/http/http_proxy_client_socket.cc
|
| ===================================================================
|
| --- net/http/http_proxy_client_socket.cc (revision 114226)
|
| +++ net/http/http_proxy_client_socket.cc (working copy)
|
| @@ -67,7 +67,7 @@
|
| DCHECK(user_callback_.is_null());
|
|
|
| int rv = PrepareForAuthRestart();
|
| - if (rv != OK || next_state_ == STATE_NONE)
|
| + if (rv != OK)
|
| return rv;
|
|
|
| rv = DoLoop(OK);
|
| @@ -79,11 +79,6 @@
|
| return rv;
|
| }
|
|
|
| -const
|
| -scoped_refptr<HttpAuthController>& HttpProxyClientSocket::auth_controller() {
|
| - return auth_;
|
| -}
|
| -
|
| const HttpResponseInfo* HttpProxyClientSocket::GetConnectResponseInfo() const {
|
| return response_.headers ? &response_ : NULL;
|
| }
|
| @@ -258,7 +253,10 @@
|
| next_state_ = STATE_GENERATE_AUTH_TOKEN;
|
| transport_->set_is_reused(true);
|
| } else {
|
| - next_state_ = STATE_NONE;
|
| + // This assumes that the underlying transport socket is a TCP socket,
|
| + // since only TCP sockets are restartable.
|
| + next_state_ = STATE_TCP_RESTART;
|
| + transport_->socket()->Disconnect();
|
| }
|
|
|
| // Reset the other member variables.
|
| @@ -271,6 +269,17 @@
|
| return OK;
|
| }
|
|
|
| +int HttpProxyClientSocket::HandleAuthChallenge() {
|
| + DCHECK(response_.headers);
|
| +
|
| + int rv = auth_->HandleAuthChallenge(response_.headers, false, true, net_log_);
|
| + response_.auth_challenge = auth_->auth_info();
|
| + if (rv == OK)
|
| + return ERR_PROXY_AUTH_REQUESTED;
|
| +
|
| + return rv;
|
| +}
|
| +
|
| void HttpProxyClientSocket::LogBlockedTunnelResponse(int response_code) const {
|
| LOG(WARNING) << "Blocked proxy response with status " << response_code
|
| << " to CONNECT request for "
|
| @@ -340,6 +349,13 @@
|
| case STATE_DRAIN_BODY_COMPLETE:
|
| rv = DoDrainBodyComplete(rv);
|
| break;
|
| + case STATE_TCP_RESTART:
|
| + DCHECK_EQ(OK, rv);
|
| + rv = DoTCPRestart();
|
| + break;
|
| + case STATE_TCP_RESTART_COMPLETE:
|
| + rv = DoTCPRestartComplete(rv);
|
| + break;
|
| case STATE_DONE:
|
| break;
|
| default:
|
| @@ -438,7 +454,7 @@
|
| // authentication code is smart enough to avoid being tricked by an
|
| // active network attacker.
|
| // The next state is intentionally not set as it should be STATE_NONE;
|
| - return HandleAuthChallenge(auth_, &response_, net_log_);
|
| + return HandleAuthChallenge();
|
|
|
| default:
|
| if (is_https_proxy_)
|
| @@ -474,4 +490,18 @@
|
| return OK;
|
| }
|
|
|
| +int HttpProxyClientSocket::DoTCPRestart() {
|
| + next_state_ = STATE_TCP_RESTART_COMPLETE;
|
| + return transport_->socket()->Connect(
|
| + base::Bind(&HttpProxyClientSocket::OnIOComplete, base::Unretained(this)));
|
| +}
|
| +
|
| +int HttpProxyClientSocket::DoTCPRestartComplete(int result) {
|
| + if (result != OK)
|
| + return result;
|
| +
|
| + next_state_ = STATE_GENERATE_AUTH_TOKEN;
|
| + return result;
|
| +}
|
| +
|
| } // namespace net
|
|
|