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

Unified Diff: net/http/http_proxy_client_socket.cc

Issue 8609006: Revert 110879 - Allow chrome to handle 407 auth challenges to CONNECT requests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: 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 110879)
+++ net/http/http_proxy_client_socket.cc (working copy)
@@ -68,7 +68,7 @@
DCHECK(!user_callback_);
int rv = PrepareForAuthRestart();
- if (rv != OK || next_state_ == STATE_NONE)
+ if (rv != OK)
return rv;
rv = DoLoop(OK);
@@ -77,11 +77,6 @@
return rv;
}
-const
-scoped_refptr<HttpAuthController>& HttpProxyClientSocket::auth_controller() {
- return auth_;
-}
-
const HttpResponseInfo* HttpProxyClientSocket::GetConnectResponseInfo() const {
return response_.headers ? &response_ : NULL;
}
@@ -256,7 +251,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.
@@ -269,6 +267,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 "
@@ -338,6 +347,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:
@@ -436,7 +452,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_)
@@ -472,4 +488,17 @@
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