OLD | NEW |
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 "net/socket/client_socket_pool_manager.h" | 5 #include "net/socket/client_socket_pool_manager.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/stringprintf.h" | 10 #include "base/stringprintf.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 HttpNetworkSession* session, | 45 HttpNetworkSession* session, |
46 const ProxyInfo& proxy_info, | 46 const ProxyInfo& proxy_info, |
47 bool force_spdy_over_ssl, | 47 bool force_spdy_over_ssl, |
48 bool want_spdy_over_npn, | 48 bool want_spdy_over_npn, |
49 const SSLConfig& ssl_config_for_origin, | 49 const SSLConfig& ssl_config_for_origin, |
50 const SSLConfig& ssl_config_for_proxy, | 50 const SSLConfig& ssl_config_for_proxy, |
51 bool force_tunnel, | 51 bool force_tunnel, |
52 const BoundNetLog& net_log, | 52 const BoundNetLog& net_log, |
53 int num_preconnect_streams, | 53 int num_preconnect_streams, |
54 ClientSocketHandle* socket_handle, | 54 ClientSocketHandle* socket_handle, |
55 const CompletionCallback& callback) { | 55 const CompletionCallback& callback, |
| 56 TunnelAuthNeededCB auth_needed_callback) { |
56 scoped_refptr<TransportSocketParams> tcp_params; | 57 scoped_refptr<TransportSocketParams> tcp_params; |
57 scoped_refptr<HttpProxySocketParams> http_proxy_params; | 58 scoped_refptr<HttpProxySocketParams> http_proxy_params; |
58 scoped_refptr<SOCKSSocketParams> socks_params; | 59 scoped_refptr<SOCKSSocketParams> socks_params; |
59 scoped_ptr<HostPortPair> proxy_host_port; | 60 scoped_ptr<HostPortPair> proxy_host_port; |
60 | 61 |
61 bool using_ssl = request_url.SchemeIs("https") || force_spdy_over_ssl; | 62 bool using_ssl = request_url.SchemeIs("https") || force_spdy_over_ssl; |
62 | 63 |
63 HostPortPair origin_host_port = | 64 HostPortPair origin_host_port = |
64 HostPortPair(request_url.HostNoBrackets(), | 65 HostPortPair(request_url.HostNoBrackets(), |
65 request_url.EffectiveIntPort()); | 66 request_url.EffectiveIntPort()); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 | 130 |
130 http_proxy_params = | 131 http_proxy_params = |
131 new HttpProxySocketParams(proxy_tcp_params, | 132 new HttpProxySocketParams(proxy_tcp_params, |
132 ssl_params, | 133 ssl_params, |
133 request_url, | 134 request_url, |
134 user_agent, | 135 user_agent, |
135 origin_host_port, | 136 origin_host_port, |
136 session->http_auth_cache(), | 137 session->http_auth_cache(), |
137 session->http_auth_handler_factory(), | 138 session->http_auth_handler_factory(), |
138 session->spdy_session_pool(), | 139 session->spdy_session_pool(), |
139 force_tunnel || using_ssl); | 140 force_tunnel || using_ssl, |
| 141 auth_needed_callback); |
140 } else { | 142 } else { |
141 DCHECK(proxy_info.is_socks()); | 143 DCHECK(proxy_info.is_socks()); |
142 char socks_version; | 144 char socks_version; |
143 if (proxy_server.scheme() == ProxyServer::SCHEME_SOCKS5) | 145 if (proxy_server.scheme() == ProxyServer::SCHEME_SOCKS5) |
144 socks_version = '5'; | 146 socks_version = '5'; |
145 else | 147 else |
146 socks_version = '4'; | 148 socks_version = '4'; |
147 connection_group = base::StringPrintf( | 149 connection_group = base::StringPrintf( |
148 "socks%c/%s", socks_version, connection_group.c_str()); | 150 "socks%c/%s", socks_version, connection_group.c_str()); |
149 | 151 |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 int request_load_flags, | 284 int request_load_flags, |
283 RequestPriority request_priority, | 285 RequestPriority request_priority, |
284 HttpNetworkSession* session, | 286 HttpNetworkSession* session, |
285 const ProxyInfo& proxy_info, | 287 const ProxyInfo& proxy_info, |
286 bool force_spdy_over_ssl, | 288 bool force_spdy_over_ssl, |
287 bool want_spdy_over_npn, | 289 bool want_spdy_over_npn, |
288 const SSLConfig& ssl_config_for_origin, | 290 const SSLConfig& ssl_config_for_origin, |
289 const SSLConfig& ssl_config_for_proxy, | 291 const SSLConfig& ssl_config_for_proxy, |
290 const BoundNetLog& net_log, | 292 const BoundNetLog& net_log, |
291 ClientSocketHandle* socket_handle, | 293 ClientSocketHandle* socket_handle, |
292 const CompletionCallback& callback) { | 294 const CompletionCallback& callback, |
| 295 TunnelAuthNeededCB auth_needed_callback) { |
| 296 |
293 DCHECK(socket_handle); | 297 DCHECK(socket_handle); |
294 return InitSocketPoolHelper( | 298 return InitSocketPoolHelper( |
295 request_url, request_extra_headers, request_load_flags, request_priority, | 299 request_url, request_extra_headers, request_load_flags, request_priority, |
296 session, proxy_info, force_spdy_over_ssl, want_spdy_over_npn, | 300 session, proxy_info, force_spdy_over_ssl, want_spdy_over_npn, |
297 ssl_config_for_origin, ssl_config_for_proxy, false, net_log, 0, | 301 ssl_config_for_origin, ssl_config_for_proxy, false, net_log, 0, |
298 socket_handle, callback); | 302 socket_handle, callback, auth_needed_callback); |
299 } | 303 } |
300 | 304 |
301 int InitSocketHandleForRawConnect( | 305 int InitSocketHandleForRawConnect( |
302 const HostPortPair& host_port_pair, | 306 const HostPortPair& host_port_pair, |
303 HttpNetworkSession* session, | 307 HttpNetworkSession* session, |
304 const ProxyInfo& proxy_info, | 308 const ProxyInfo& proxy_info, |
305 const SSLConfig& ssl_config_for_origin, | 309 const SSLConfig& ssl_config_for_origin, |
306 const SSLConfig& ssl_config_for_proxy, | 310 const SSLConfig& ssl_config_for_proxy, |
307 const BoundNetLog& net_log, | 311 const BoundNetLog& net_log, |
308 ClientSocketHandle* socket_handle, | 312 ClientSocketHandle* socket_handle, |
309 const CompletionCallback& callback) { | 313 const CompletionCallback& callback, |
| 314 TunnelAuthNeededCB auth_needed_callback) { |
310 DCHECK(socket_handle); | 315 DCHECK(socket_handle); |
311 // Synthesize an HttpRequestInfo. | 316 // Synthesize an HttpRequestInfo. |
312 GURL request_url = GURL("http://" + host_port_pair.ToString()); | 317 GURL request_url = GURL("http://" + host_port_pair.ToString()); |
313 HttpRequestHeaders request_extra_headers; | 318 HttpRequestHeaders request_extra_headers; |
314 int request_load_flags = 0; | 319 int request_load_flags = 0; |
315 RequestPriority request_priority = MEDIUM; | 320 RequestPriority request_priority = MEDIUM; |
316 | |
317 return InitSocketPoolHelper( | 321 return InitSocketPoolHelper( |
318 request_url, request_extra_headers, request_load_flags, request_priority, | 322 request_url, request_extra_headers, request_load_flags, request_priority, |
319 session, proxy_info, false, false, ssl_config_for_origin, | 323 session, proxy_info, false, false, ssl_config_for_origin, |
320 ssl_config_for_proxy, true, net_log, 0, socket_handle, callback); | 324 ssl_config_for_proxy, true, net_log, 0, socket_handle, callback, |
| 325 auth_needed_callback); |
321 } | 326 } |
322 | 327 |
323 int PreconnectSocketsForHttpRequest( | 328 int PreconnectSocketsForHttpRequest( |
324 const GURL& request_url, | 329 const GURL& request_url, |
325 const HttpRequestHeaders& request_extra_headers, | 330 const HttpRequestHeaders& request_extra_headers, |
326 int request_load_flags, | 331 int request_load_flags, |
327 RequestPriority request_priority, | 332 RequestPriority request_priority, |
328 HttpNetworkSession* session, | 333 HttpNetworkSession* session, |
329 const ProxyInfo& proxy_info, | 334 const ProxyInfo& proxy_info, |
330 bool force_spdy_over_ssl, | 335 bool force_spdy_over_ssl, |
331 bool want_spdy_over_npn, | 336 bool want_spdy_over_npn, |
332 const SSLConfig& ssl_config_for_origin, | 337 const SSLConfig& ssl_config_for_origin, |
333 const SSLConfig& ssl_config_for_proxy, | 338 const SSLConfig& ssl_config_for_proxy, |
334 const BoundNetLog& net_log, | 339 const BoundNetLog& net_log, |
335 int num_preconnect_streams) { | 340 int num_preconnect_streams, |
| 341 TunnelAuthNeededCB auth_needed_callback) { |
336 return InitSocketPoolHelper( | 342 return InitSocketPoolHelper( |
337 request_url, request_extra_headers, request_load_flags, request_priority, | 343 request_url, request_extra_headers, request_load_flags, request_priority, |
338 session, proxy_info, force_spdy_over_ssl, want_spdy_over_npn, | 344 session, proxy_info, force_spdy_over_ssl, want_spdy_over_npn, |
339 ssl_config_for_origin, ssl_config_for_proxy, false, net_log, | 345 ssl_config_for_origin, ssl_config_for_proxy, false, net_log, |
340 num_preconnect_streams, NULL, CompletionCallback()); | 346 num_preconnect_streams, NULL, CompletionCallback(), auth_needed_callback); |
341 } | 347 } |
342 | 348 |
343 } // namespace net | 349 } // namespace net |
OLD | NEW |