| Index: net/http/http_proxy_client_socket.cc
|
| ===================================================================
|
| --- net/http/http_proxy_client_socket.cc (revision 118888)
|
| +++ net/http/http_proxy_client_socket.cc (working copy)
|
| @@ -31,8 +31,7 @@
|
| const std::string& user_agent,
|
| const HostPortPair& endpoint,
|
| const HostPortPair& proxy_server,
|
| - HttpAuthCache* http_auth_cache,
|
| - HttpAuthHandlerFactory* http_auth_handler_factory,
|
| + HttpAuthController* http_auth_controller,
|
| bool tunnel,
|
| bool using_spdy,
|
| SSLClientSocket::NextProto protocol_negotiated,
|
| @@ -43,13 +42,7 @@
|
| next_state_(STATE_NONE),
|
| transport_(transport_socket),
|
| endpoint_(endpoint),
|
| - auth_(tunnel ?
|
| - new HttpAuthController(HttpAuth::AUTH_PROXY,
|
| - GURL((is_https_proxy ? "https://" : "http://")
|
| - + proxy_server.ToString()),
|
| - http_auth_cache,
|
| - http_auth_handler_factory)
|
| - : NULL),
|
| + auth_(http_auth_controller),
|
| tunnel_(tunnel),
|
| using_spdy_(using_spdy),
|
| protocol_negotiated_(protocol_negotiated),
|
| @@ -67,6 +60,11 @@
|
| Disconnect();
|
| }
|
|
|
| +const
|
| +scoped_refptr<HttpAuthController>& HttpProxyClientSocket::GetAuthController() {
|
| + return auth_;
|
| +}
|
| +
|
| int HttpProxyClientSocket::RestartWithAuth(const CompletionCallback& callback) {
|
| DCHECK_EQ(STATE_NONE, next_state_);
|
| DCHECK(user_callback_.is_null());
|
| @@ -254,14 +252,14 @@
|
| }
|
|
|
| int HttpProxyClientSocket::DidDrainBodyForAuthRestart(bool keep_alive) {
|
| + int rv = OK;
|
| if (keep_alive && transport_->socket()->IsConnectedAndIdle()) {
|
| next_state_ = STATE_GENERATE_AUTH_TOKEN;
|
| transport_->set_is_reused(true);
|
| } else {
|
| - // This assumes that the underlying transport socket is a TCP socket,
|
| - // since only TCP sockets are restartable.
|
| - next_state_ = STATE_TCP_RESTART;
|
| + next_state_ = STATE_NONE;
|
| transport_->socket()->Disconnect();
|
| + rv = ERR_NO_KEEP_ALIVE_ON_AUTH_RESTART;
|
| }
|
|
|
| // Reset the other member variables.
|
| @@ -271,17 +269,6 @@
|
| request_line_.clear();
|
| request_headers_.Clear();
|
| response_ = HttpResponseInfo();
|
| - 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;
|
| }
|
|
|
| @@ -354,13 +341,6 @@
|
| 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:
|
| @@ -459,7 +439,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();
|
| + return HandleAuthChallenge(auth_, &response_, net_log_);
|
|
|
| default:
|
| if (is_https_proxy_)
|
| @@ -495,18 +475,4 @@
|
| 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
|
|
|