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

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
« no previous file with comments | « net/http/http_stream_factory_impl_job.h ('k') | net/http/http_stream_factory_impl_request.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_stream_factory_impl_job.cc
===================================================================
--- net/http/http_stream_factory_impl_job.cc (revision 118888)
+++ net/http/http_stream_factory_impl_job.cc (working copy)
@@ -181,14 +181,22 @@
return StartInternal();
}
-int HttpStreamFactoryImpl::Job::RestartTunnelWithProxyAuth(
- const AuthCredentials& credentials) {
- DCHECK(establishing_tunnel_);
- next_state_ = STATE_RESTART_TUNNEL_AUTH;
- stream_.reset();
- return RunLoop(OK);
+int HttpStreamFactoryImpl::Job::RestartTunnelWithProxyAuth() {
+ // We run this asynchronously to ensure that we don't invoke
+ // the callback (which might cause the caller to be deleted)
+ // while the caller is waiting for this method to return.
+ MessageLoop::current()->PostTask(
+ FROM_HERE,
+ base::Bind(&HttpStreamFactoryImpl::Job::DoRestartTunnelWithProxyAuth,
+ ptr_factory_.GetWeakPtr()));
+ return ERR_IO_PENDING;
}
+void HttpStreamFactoryImpl::Job::DoRestartTunnelWithProxyAuth() {
+ tunnel_auth_handled_callback_.Run(OK);
+ tunnel_auth_handled_callback_.Reset();
+}
+
LoadState HttpStreamFactoryImpl::Job::GetLoadState() const {
switch (next_state_) {
case STATE_RESOLVE_PROXY_COMPLETE:
@@ -342,6 +350,18 @@
// |this| may be deleted after this call.
}
+void HttpStreamFactoryImpl::Job::OnNeedsProxyTunnelAuthCallback(
+ const HttpResponseInfo& response_info,
+ HttpAuthController* auth_controller,
+ CompletionCallback callback) {
+ DCHECK(!callback.is_null());
+ DCHECK(tunnel_auth_handled_callback_.is_null());
+ tunnel_auth_handled_callback_ = callback;
+ 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());
@@ -420,10 +440,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(
@@ -432,7 +452,7 @@
&HttpStreamFactoryImpl::Job::OnNeedsProxyAuthCallback,
ptr_factory_.GetWeakPtr(),
*tunnel_auth_response,
- http_proxy_socket->auth_controller()));
+ proxy_socket->GetAuthController()));
}
return ERR_IO_PENDING;
@@ -733,13 +753,18 @@
server_ssl_config_,
proxy_ssl_config_,
net_log_,
- num_streams_);
+ num_streams_,
+ base::Bind(&HttpStreamFactoryImpl::Job::OnNeedsProxyTunnelAuthCallback,
+ ptr_factory_.GetWeakPtr()));
} 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(),
+ base::Bind(&HttpStreamFactoryImpl::Job::OnNeedsProxyTunnelAuthCallback,
+ ptr_factory_.GetWeakPtr()),
+ io_callback_);
}
}
« no previous file with comments | « net/http/http_stream_factory_impl_job.h ('k') | net/http/http_stream_factory_impl_request.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698