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

Side by Side Diff: jingle/notifier/base/proxy_resolving_client_socket.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: Removed Jingle todo 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "jingle/notifier/base/proxy_resolving_client_socket.h" 5 #include "jingle/notifier/base/proxy_resolving_client_socket.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/bind_helpers.h" 9 #include "base/bind_helpers.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 CloseTransportSocket(); 165 CloseTransportSocket();
166 RunUserConnectCallback(status); 166 RunUserConnectCallback(status);
167 return; 167 return;
168 } 168 }
169 } 169 }
170 170
171 transport_.reset(new net::ClientSocketHandle); 171 transport_.reset(new net::ClientSocketHandle);
172 // Now that we have resolved the proxy, we need to connect. 172 // Now that we have resolved the proxy, we need to connect.
173 status = net::InitSocketHandleForRawConnect( 173 status = net::InitSocketHandleForRawConnect(
174 dest_host_port_pair_, network_session_.get(), proxy_info_, ssl_config_, 174 dest_host_port_pair_, network_session_.get(), proxy_info_, ssl_config_,
175 ssl_config_, bound_net_log_, transport_.get(), connect_callback_); 175 ssl_config_, bound_net_log_, transport_.get(), connect_callback_,
176 base::Bind(&ProxyResolvingClientSocket::OnNeedsProxyTunnelAuthCallback,
177 base::Unretained(this)));
akalin 2012/01/19 21:20:40 is it really safe to use Unretained here? If so i
176 if (status != net::ERR_IO_PENDING) { 178 if (status != net::ERR_IO_PENDING) {
177 // Since this method is always called asynchronously. it is OK to call 179 // Since this method is always called asynchronously. it is OK to call
178 // ProcessConnectDone synchronously. 180 // ProcessConnectDone synchronously.
179 ProcessConnectDone(status); 181 ProcessConnectDone(status);
180 } 182 }
181 } 183 }
182 184
185 void ProxyResolvingClientSocket::OnNeedsProxyTunnelAuthCallback(
186 const net::HttpResponseInfo& response_info,
187 net::HttpAuthController* auth_controller,
188 net::CompletionCallback callback) {
189 // Since have not way to respond, simply invoke the callback and the
190 // request will fail.
191 callback.Run(net::OK);
192 }
193
183 void ProxyResolvingClientSocket::ProcessConnectDone(int status) { 194 void ProxyResolvingClientSocket::ProcessConnectDone(int status) {
184 if (status != net::OK) { 195 if (status != net::OK) {
185 // If the connection fails, try another proxy. 196 // If the connection fails, try another proxy.
186 status = ReconsiderProxyAfterError(status); 197 status = ReconsiderProxyAfterError(status);
187 // ReconsiderProxyAfterError either returns an error (in which case it is 198 // ReconsiderProxyAfterError either returns an error (in which case it is
188 // not reconsidering a proxy) or returns ERR_IO_PENDING if it is considering 199 // not reconsidering a proxy) or returns ERR_IO_PENDING if it is considering
189 // another proxy. 200 // another proxy.
190 DCHECK_NE(status, net::OK); 201 DCHECK_NE(status, net::OK);
191 if (status == net::ERR_IO_PENDING) 202 if (status == net::ERR_IO_PENDING)
192 // Proxy reconsideration pending. Return. 203 // Proxy reconsideration pending. Return.
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 return base::TimeDelta::FromMicroseconds(-1); 377 return base::TimeDelta::FromMicroseconds(-1);
367 } 378 }
368 379
369 void ProxyResolvingClientSocket::CloseTransportSocket() { 380 void ProxyResolvingClientSocket::CloseTransportSocket() {
370 if (transport_.get() && transport_->socket()) 381 if (transport_.get() && transport_->socket())
371 transport_->socket()->Disconnect(); 382 transport_->socket()->Disconnect();
372 transport_.reset(); 383 transport_.reset();
373 } 384 }
374 385
375 } // namespace notifier 386 } // namespace notifier
OLDNEW
« no previous file with comments | « jingle/notifier/base/proxy_resolving_client_socket.h ('k') | net/http/http_network_transaction_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698