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

Unified Diff: net/http/http_proxy_client_socket.cc

Issue 8502024: Allow chrome to handle 407 auth challenges to CONNECT requests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: fix typo in unittest Created 9 years, 1 month 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/http/http_proxy_client_socket.h ('k') | net/http/http_proxy_client_socket_pool_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_proxy_client_socket.cc
===================================================================
--- net/http/http_proxy_client_socket.cc (revision 110584)
+++ net/http/http_proxy_client_socket.cc (working copy)
@@ -68,7 +68,7 @@
DCHECK(!user_callback_);
int rv = PrepareForAuthRestart();
- if (rv != OK)
+ if (rv != OK || next_state_ == STATE_NONE)
return rv;
rv = DoLoop(OK);
@@ -77,6 +77,11 @@
return rv;
}
+const
+scoped_refptr<HttpAuthController>& HttpProxyClientSocket::auth_controller() {
+ return auth_;
+}
+
const HttpResponseInfo* HttpProxyClientSocket::GetConnectResponseInfo() const {
return response_.headers ? &response_ : NULL;
}
@@ -251,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();
+ next_state_ = STATE_NONE;
}
// Reset the other member variables.
@@ -267,17 +269,6 @@
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 "
@@ -347,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:
@@ -452,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_)
@@ -488,17 +472,4 @@
return OK;
}
-int HttpProxyClientSocket::DoTCPRestart() {
- next_state_ = STATE_TCP_RESTART_COMPLETE;
- return transport_->socket()->Connect(&io_callback_);
-}
-
-int HttpProxyClientSocket::DoTCPRestartComplete(int result) {
- if (result != OK)
- return result;
-
- next_state_ = STATE_GENERATE_AUTH_TOKEN;
- return result;
-}
-
} // namespace net
« no previous file with comments | « net/http/http_proxy_client_socket.h ('k') | net/http/http_proxy_client_socket_pool_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698