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

Side by Side Diff: net/http/http_proxy_client_socket_pool.cc

Issue 3029052: Recommit 54405 - Fix late binding induced mismatch of Socket and AuthController (Closed)
Patch Set: Created 10 years, 4 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
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "net/http/http_proxy_client_socket_pool.h" 5 #include "net/http/http_proxy_client_socket_pool.h"
6 6
7 #include "base/time.h" 7 #include "base/time.h"
8 #include "googleurl/src/gurl.h" 8 #include "googleurl/src/gurl.h"
9 #include "net/base/net_errors.h" 9 #include "net/base/net_errors.h"
10 #include "net/http/http_network_session.h"
10 #include "net/http/http_proxy_client_socket.h" 11 #include "net/http/http_proxy_client_socket.h"
11 #include "net/socket/client_socket_factory.h" 12 #include "net/socket/client_socket_factory.h"
12 #include "net/socket/client_socket_handle.h" 13 #include "net/socket/client_socket_handle.h"
13 #include "net/socket/client_socket_pool_base.h" 14 #include "net/socket/client_socket_pool_base.h"
14 15
15 namespace net { 16 namespace net {
16 17
17 HttpProxySocketParams::HttpProxySocketParams( 18 HttpProxySocketParams::HttpProxySocketParams(
18 const scoped_refptr<TCPSocketParams>& proxy_server, 19 const scoped_refptr<TCPSocketParams>& proxy_server,
19 const GURL& request_url, 20 const GURL& request_url,
20 HostPortPair endpoint, 21 HostPortPair endpoint,
21 scoped_refptr<HttpAuthController> auth_controller, 22 scoped_refptr<HttpNetworkSession> session,
22 bool tunnel) 23 bool tunnel)
23 : tcp_params_(proxy_server), 24 : tcp_params_(proxy_server),
24 request_url_(request_url), 25 request_url_(request_url),
25 endpoint_(endpoint), 26 endpoint_(endpoint),
26 auth_controller_(auth_controller), 27 session_(session),
27 tunnel_(tunnel) { 28 tunnel_(tunnel) {
28 } 29 }
29 30
30 HttpProxySocketParams::~HttpProxySocketParams() {} 31 HttpProxySocketParams::~HttpProxySocketParams() {}
31 32
32 // HttpProxyConnectJobs will time out after this many seconds. Note this is on 33 // HttpProxyConnectJobs will time out after this many seconds. Note this is on
33 // top of the timeout for the transport socket. 34 // top of the timeout for the transport socket.
34 static const int kHttpProxyConnectJobTimeoutInSeconds = 30; 35 static const int kHttpProxyConnectJobTimeoutInSeconds = 30;
35 36
36 HttpProxyConnectJob::HttpProxyConnectJob( 37 HttpProxyConnectJob::HttpProxyConnectJob(
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 // so that a fast TCP connection plus a slow HttpProxy failure doesn't take 127 // so that a fast TCP connection plus a slow HttpProxy failure doesn't take
127 // longer to timeout than it should. 128 // longer to timeout than it should.
128 ResetTimer(base::TimeDelta::FromSeconds( 129 ResetTimer(base::TimeDelta::FromSeconds(
129 kHttpProxyConnectJobTimeoutInSeconds)); 130 kHttpProxyConnectJobTimeoutInSeconds));
130 next_state_ = kStateHttpProxyConnect; 131 next_state_ = kStateHttpProxyConnect;
131 return result; 132 return result;
132 } 133 }
133 134
134 int HttpProxyConnectJob::DoHttpProxyConnect() { 135 int HttpProxyConnectJob::DoHttpProxyConnect() {
135 next_state_ = kStateHttpProxyConnectComplete; 136 next_state_ = kStateHttpProxyConnectComplete;
137 const HostResolver::RequestInfo& tcp_destination =
138 params_->tcp_params()->destination();
139 HostPortPair proxy_server(tcp_destination.hostname(),
140 tcp_destination.port());
136 141
137 // Add a HttpProxy connection on top of the tcp socket. 142 // Add a HttpProxy connection on top of the tcp socket.
138 socket_.reset(new HttpProxyClientSocket(tcp_socket_handle_.release(), 143 socket_.reset(new HttpProxyClientSocket(tcp_socket_handle_.release(),
139 params_->request_url(), 144 params_->request_url(),
140 params_->endpoint(), 145 params_->endpoint(),
141 params_->auth_controller(), 146 proxy_server,
147 params_->session(),
142 params_->tunnel())); 148 params_->tunnel()));
143 return socket_->Connect(&callback_); 149 return socket_->Connect(&callback_);
144 } 150 }
145 151
146 int HttpProxyConnectJob::DoHttpProxyConnectComplete(int result) { 152 int HttpProxyConnectJob::DoHttpProxyConnectComplete(int result) {
147 DCHECK_NE(result, ERR_RETRY_CONNECTION);
148
149 if (result == OK || result == ERR_PROXY_AUTH_REQUESTED) 153 if (result == OK || result == ERR_PROXY_AUTH_REQUESTED)
150 set_socket(socket_.release()); 154 set_socket(socket_.release());
151 155
152 return result; 156 return result;
153 } 157 }
154 158
155 ConnectJob* 159 ConnectJob*
156 HttpProxyClientSocketPool::HttpProxyConnectJobFactory::NewConnectJob( 160 HttpProxyClientSocketPool::HttpProxyConnectJobFactory::NewConnectJob(
157 const std::string& group_name, 161 const std::string& group_name,
158 const PoolBase::Request& request, 162 const PoolBase::Request& request,
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 const std::string& group_name) const { 224 const std::string& group_name) const {
221 return base_.IdleSocketCountInGroup(group_name); 225 return base_.IdleSocketCountInGroup(group_name);
222 } 226 }
223 227
224 LoadState HttpProxyClientSocketPool::GetLoadState( 228 LoadState HttpProxyClientSocketPool::GetLoadState(
225 const std::string& group_name, const ClientSocketHandle* handle) const { 229 const std::string& group_name, const ClientSocketHandle* handle) const {
226 return base_.GetLoadState(group_name, handle); 230 return base_.GetLoadState(group_name, handle);
227 } 231 }
228 232
229 } // namespace net 233 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_proxy_client_socket_pool.h ('k') | net/http/http_proxy_client_socket_pool_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698