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

Unified Diff: net/http/http_stream_factory_impl_job.cc

Issue 9148011: Allow chrome to handle 407 auth challenges to CONNECT requests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 8 years, 11 months 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
Index: net/http/http_stream_factory_impl_job.cc
===================================================================
--- net/http/http_stream_factory_impl_job.cc (revision 117986)
+++ net/http/http_stream_factory_impl_job.cc (working copy)
@@ -183,12 +183,17 @@
int HttpStreamFactoryImpl::Job::RestartTunnelWithProxyAuth(
const AuthCredentials& credentials) {
vandebo (ex-Chrome) 2012/01/19 20:12:49 The credentials are thrown away? It looks like th
Ryan Hamilton 2012/01/19 23:11:19 Done. Looks like it could also be removed from Ht
- DCHECK(establishing_tunnel_);
- next_state_ = STATE_RESTART_TUNNEL_AUTH;
- stream_.reset();
- return RunLoop(OK);
+ MessageLoop::current()->PostTask(
cbentzel 2012/01/20 02:09:46 Is this needed due to reentrancy concerns with tun
Ryan Hamilton 2012/01/20 04:20:04 Yes... Specifically, we want to invoke the callbac
cbentzel 2012/01/20 11:15:46 Could you add a comment about this? It was non-obv
Ryan Hamilton 2012/01/20 17:20:13 Done.
+ FROM_HERE,
+ base::Bind(&HttpStreamFactoryImpl::Job::ReallyRestartTunnelWithProxyAuth,
+ ptr_factory_.GetWeakPtr()));
+ return ERR_IO_PENDING;
}
+void HttpStreamFactoryImpl::Job::ReallyRestartTunnelWithProxyAuth() {
+ tunnel_auth_handled_callback_.Run(OK);
+}
vandebo (ex-Chrome) 2012/01/19 20:12:49 Null out tunnel_auth_handled_callback_ when you're
Ryan Hamilton 2012/01/19 23:11:19 tunnel_auth_handled_callback_ is not a pointer, it
+
LoadState HttpStreamFactoryImpl::Job::GetLoadState() const {
switch (next_state_) {
case STATE_RESOLVE_PROXY_COMPLETE:
@@ -342,6 +347,16 @@
// |this| may be deleted after this call.
}
+void HttpStreamFactoryImpl::Job::OnNeedsProxyTunnelAuthCallback(
+ const HttpResponseInfo& response_info,
+ HttpAuthController* auth_controller,
+ CompletionCallback callback) {
+ tunnel_auth_handled_callback_ = callback;
vandebo (ex-Chrome) 2012/01/19 20:12:49 DCHECK that tunnel_auth_handled_callback_ == NULL
Ryan Hamilton 2012/01/19 23:11:19 tunnel_auth_handled_callback_ is not a pointer, it
+ request_->OnNeedsProxyAuth(
+ this, response_info, server_ssl_config_, proxy_info_, auth_controller);
+ // |this| may be deleted after this call.
+}
+
void HttpStreamFactoryImpl::Job::OnNeedsClientAuthCallback(
SSLCertRequestInfo* cert_info) {
DCHECK(!IsPreconnecting());
@@ -416,10 +431,10 @@
DCHECK(connection_->socket());
DCHECK(establishing_tunnel_);
- HttpProxyClientSocket* http_proxy_socket =
- static_cast<HttpProxyClientSocket*>(connection_->socket());
+ ProxyClientSocket* proxy_socket =
+ static_cast<ProxyClientSocket*>(connection_->socket());
const HttpResponseInfo* tunnel_auth_response =
- http_proxy_socket->GetConnectResponseInfo();
+ proxy_socket->GetConnectResponseInfo();
next_state_ = STATE_WAITING_USER_ACTION;
MessageLoop::current()->PostTask(
@@ -428,7 +443,7 @@
&HttpStreamFactoryImpl::Job::OnNeedsProxyAuthCallback,
ptr_factory_.GetWeakPtr(),
*tunnel_auth_response,
- http_proxy_socket->auth_controller()));
+ proxy_socket->auth_controller()));
}
return ERR_IO_PENDING;
@@ -721,13 +736,17 @@
server_ssl_config_,
proxy_ssl_config_,
net_log_,
- num_streams_);
+ num_streams_,
+ base::Bind(&HttpStreamFactoryImpl::Job::OnNeedsProxyTunnelAuthCallback,
+ base::Unretained(this)));
} else {
return InitSocketHandleForHttpRequest(
origin_url_, request_info_.extra_headers, request_info_.load_flags,
request_info_.priority, session_, proxy_info_, ShouldForceSpdySSL(),
want_spdy_over_npn, server_ssl_config_, proxy_ssl_config_, net_log_,
- connection_.get(), io_callback_);
+ connection_.get(), io_callback_,
+ base::Bind(&HttpStreamFactoryImpl::Job::OnNeedsProxyTunnelAuthCallback,
+ base::Unretained(this)));
}
}

Powered by Google App Engine
This is Rietveld 408576698