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

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: Use weak pointer instead of Unretained(this) in jingle 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) {
- DCHECK(establishing_tunnel_);
- next_state_ = STATE_RESTART_TUNNEL_AUTH;
- stream_.reset();
- return RunLoop(OK);
+ MessageLoop::current()->PostTask(
+ FROM_HERE,
+ base::Bind(&HttpStreamFactoryImpl::Job::ReallyRestartTunnelWithProxyAuth,
+ ptr_factory_.GetWeakPtr()));
+ return ERR_IO_PENDING;
}
+void HttpStreamFactoryImpl::Job::ReallyRestartTunnelWithProxyAuth() {
+ tunnel_auth_handled_callback_.Run(OK);
+}
+
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;
+ 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)));
akalin 2012/01/19 22:12:48 weakptr?
Ryan Hamilton 2012/01/19 23:11:19 Done.
} 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)));
akalin 2012/01/19 22:12:48 weakptr?
Ryan Hamilton 2012/01/19 23:11:19 Done.
}
}

Powered by Google App Engine
This is Rietveld 408576698