Index: net/http/http_proxy_client_socket.cc |
=================================================================== |
--- net/http/http_proxy_client_socket.cc (revision 117986) |
+++ 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,12 +60,17 @@ |
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()); |
int rv = PrepareForAuthRestart(); |
- if (rv != OK) |
+ if (rv != OK || next_state_ == STATE_NONE) |
vandebo (ex-Chrome)
2012/01/20 20:49:29
This change isn't needed, rv will now be ERR_NO_KE
Ryan Hamilton
2012/01/20 21:51:35
Done.
Ryan Hamilton
2012/01/20 21:51:35
Done.
|
return rv; |
rv = DoLoop(OK); |
@@ -258,10 +256,7 @@ |
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; |
- transport_->socket()->Disconnect(); |
vandebo (ex-Chrome)
2012/01/20 20:49:29
I think we still want to disconnect the socket, ot
Ryan Hamilton
2012/01/20 21:51:35
Done.
|
+ next_state_ = STATE_NONE; |
} |
// Reset the other member variables. |
@@ -271,20 +266,9 @@ |
request_line_.clear(); |
request_headers_.Clear(); |
response_ = HttpResponseInfo(); |
- return OK; |
+ return next_state_ == STATE_NONE ? ERR_NO_KEEP_ALIVE_ON_AUTH_RESTART : OK; |
vandebo (ex-Chrome)
2012/01/20 20:49:29
nit: a tristate isn't necessary. int ret = OK at
Ryan Hamilton
2012/01/20 21:51:35
Done.
|
} |
-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 " |
@@ -354,13 +338,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 +436,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 +472,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 |