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

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: '' 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
« no previous file with comments | « no previous file | net/base/net_error_list.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "googleurl/src/gurl.h" 12 #include "googleurl/src/gurl.h"
13 #include "net/base/io_buffer.h" 13 #include "net/base/io_buffer.h"
14 #include "net/base/net_errors.h" 14 #include "net/base/net_errors.h"
15 #include "net/http/http_network_session.h" 15 #include "net/http/http_network_session.h"
16 #include "net/socket/client_socket_handle.h" 16 #include "net/socket/client_socket_handle.h"
17 #include "net/socket/client_socket_pool_manager.h" 17 #include "net/socket/client_socket_pool_manager.h"
18 #include "net/url_request/url_request_context.h" 18 #include "net/url_request/url_request_context.h"
19 #include "net/url_request/url_request_context_getter.h" 19 #include "net/url_request/url_request_context_getter.h"
20 20
21 namespace notifier { 21 namespace notifier {
22 22
23 namespace {
24
25 void HandleProxyTunnelAuth(const net::HttpResponseInfo& response_info,
26 net::HttpAuthController* auth_controller,
27 net::CompletionCallback callback) {
28 // Since we have no way to respond, simply invoke the callback and the
29 // request will fail.
30 callback.Run(net::OK);
31 }
32
33 } // namespace
34
23 ProxyResolvingClientSocket::ProxyResolvingClientSocket( 35 ProxyResolvingClientSocket::ProxyResolvingClientSocket(
24 net::ClientSocketFactory* socket_factory, 36 net::ClientSocketFactory* socket_factory,
25 const scoped_refptr<net::URLRequestContextGetter>& request_context_getter, 37 const scoped_refptr<net::URLRequestContextGetter>& request_context_getter,
26 const net::SSLConfig& ssl_config, 38 const net::SSLConfig& ssl_config,
27 const net::HostPortPair& dest_host_port_pair) 39 const net::HostPortPair& dest_host_port_pair)
28 : ALLOW_THIS_IN_INITIALIZER_LIST(proxy_resolve_callback_( 40 : ALLOW_THIS_IN_INITIALIZER_LIST(proxy_resolve_callback_(
29 base::Bind(&ProxyResolvingClientSocket::ProcessProxyResolveDone, 41 base::Bind(&ProxyResolvingClientSocket::ProcessProxyResolveDone,
30 base::Unretained(this)))), 42 base::Unretained(this)))),
31 ALLOW_THIS_IN_INITIALIZER_LIST(connect_callback_( 43 ALLOW_THIS_IN_INITIALIZER_LIST(connect_callback_(
32 base::Bind(&ProxyResolvingClientSocket::ProcessConnectDone, 44 base::Bind(&ProxyResolvingClientSocket::ProcessConnectDone,
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 CloseTransportSocket(); 177 CloseTransportSocket();
166 RunUserConnectCallback(status); 178 RunUserConnectCallback(status);
167 return; 179 return;
168 } 180 }
169 } 181 }
170 182
171 transport_.reset(new net::ClientSocketHandle); 183 transport_.reset(new net::ClientSocketHandle);
172 // Now that we have resolved the proxy, we need to connect. 184 // Now that we have resolved the proxy, we need to connect.
173 status = net::InitSocketHandleForRawConnect( 185 status = net::InitSocketHandleForRawConnect(
174 dest_host_port_pair_, network_session_.get(), proxy_info_, ssl_config_, 186 dest_host_port_pair_, network_session_.get(), proxy_info_, ssl_config_,
175 ssl_config_, bound_net_log_, transport_.get(), connect_callback_); 187 ssl_config_, bound_net_log_, transport_.get(),
188 base::Bind(&HandleProxyTunnelAuth), connect_callback_);
189
176 if (status != net::ERR_IO_PENDING) { 190 if (status != net::ERR_IO_PENDING) {
177 // Since this method is always called asynchronously. it is OK to call 191 // Since this method is always called asynchronously. it is OK to call
178 // ProcessConnectDone synchronously. 192 // ProcessConnectDone synchronously.
179 ProcessConnectDone(status); 193 ProcessConnectDone(status);
180 } 194 }
181 } 195 }
182 196
183 void ProxyResolvingClientSocket::ProcessConnectDone(int status) { 197 void ProxyResolvingClientSocket::ProcessConnectDone(int status) {
184 if (status != net::OK) { 198 if (status != net::OK) {
185 // If the connection fails, try another proxy. 199 // If the connection fails, try another proxy.
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 return base::TimeDelta::FromMicroseconds(-1); 380 return base::TimeDelta::FromMicroseconds(-1);
367 } 381 }
368 382
369 void ProxyResolvingClientSocket::CloseTransportSocket() { 383 void ProxyResolvingClientSocket::CloseTransportSocket() {
370 if (transport_.get() && transport_->socket()) 384 if (transport_.get() && transport_->socket())
371 transport_->socket()->Disconnect(); 385 transport_->socket()->Disconnect();
372 transport_.reset(); 386 transport_.reset();
373 } 387 }
374 388
375 } // namespace notifier 389 } // namespace notifier
OLDNEW
« no previous file with comments | « no previous file | net/base/net_error_list.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698