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