OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
77 const SSLConfig& ssl_config_for_origin, | 77 const SSLConfig& ssl_config_for_origin, |
78 const SSLConfig& ssl_config_for_proxy, | 78 const SSLConfig& ssl_config_for_proxy, |
79 bool force_tunnel, | 79 bool force_tunnel, |
80 PrivacyMode privacy_mode, | 80 PrivacyMode privacy_mode, |
81 const BoundNetLog& net_log, | 81 const BoundNetLog& net_log, |
82 int num_preconnect_streams, | 82 int num_preconnect_streams, |
83 ClientSocketHandle* socket_handle, | 83 ClientSocketHandle* socket_handle, |
84 HttpNetworkSession::SocketPoolType socket_pool_type, | 84 HttpNetworkSession::SocketPoolType socket_pool_type, |
85 const OnHostResolutionCallback& resolution_callback, | 85 const OnHostResolutionCallback& resolution_callback, |
86 const CompletionCallback& callback) { | 86 const CompletionCallback& callback) { |
87 scoped_refptr<TransportSocketParams> tcp_params; | |
88 scoped_refptr<HttpProxySocketParams> http_proxy_params; | 87 scoped_refptr<HttpProxySocketParams> http_proxy_params; |
89 scoped_refptr<SOCKSSocketParams> socks_params; | 88 scoped_refptr<SOCKSSocketParams> socks_params; |
90 scoped_ptr<HostPortPair> proxy_host_port; | 89 scoped_ptr<HostPortPair> proxy_host_port; |
91 | 90 |
92 bool using_ssl = request_url.SchemeIs("https") || | 91 bool using_ssl = request_url.SchemeIs("https") || |
93 request_url.SchemeIs("wss") || force_spdy_over_ssl; | 92 request_url.SchemeIs("wss") || force_spdy_over_ssl; |
94 | 93 |
95 HostPortPair origin_host_port = | 94 HostPortPair origin_host_port = |
96 HostPortPair(request_url.HostNoBrackets(), | 95 HostPortPair(request_url.HostNoBrackets(), |
97 request_url.EffectiveIntPort()); | 96 request_url.EffectiveIntPort()); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
147 prefix = "sslv3/"; | 146 prefix = "sslv3/"; |
148 break; | 147 break; |
149 default: | 148 default: |
150 CHECK(false); | 149 CHECK(false); |
151 break; | 150 break; |
152 } | 151 } |
153 } | 152 } |
154 connection_group = prefix + connection_group; | 153 connection_group = prefix + connection_group; |
155 } | 154 } |
156 | 155 |
157 bool ignore_limits = (request_load_flags & LOAD_IGNORE_LIMITS) != 0; | 156 bool ignore_limits = (request_load_flags & LOAD_IGNORE_LIMITS) != 0; |
mmenke
2014/08/14 17:56:03
The struct was effectively const before, suggest k
Jana
2014/08/15 20:00:06
As we discussed offline, I've added a new construc
| |
158 if (proxy_info.is_direct()) { | 157 if (!proxy_info.is_direct()) { |
159 tcp_params = new TransportSocketParams(origin_host_port, | |
160 disable_resolver_cache, | |
161 ignore_limits, | |
162 resolution_callback); | |
163 } else { | |
164 ProxyServer proxy_server = proxy_info.proxy_server(); | 158 ProxyServer proxy_server = proxy_info.proxy_server(); |
165 proxy_host_port.reset(new HostPortPair(proxy_server.host_port_pair())); | 159 proxy_host_port.reset(new HostPortPair(proxy_server.host_port_pair())); |
166 scoped_refptr<TransportSocketParams> proxy_tcp_params( | 160 scoped_refptr<TransportSocketParams> proxy_tcp_params( |
167 new TransportSocketParams(*proxy_host_port, | 161 new TransportSocketParams(*proxy_host_port, |
168 disable_resolver_cache, | 162 disable_resolver_cache, |
169 ignore_limits, | 163 ignore_limits, |
170 resolution_callback)); | 164 resolution_callback)); |
171 | 165 |
172 if (proxy_info.is_http() || proxy_info.is_https()) { | 166 if (proxy_info.is_http() || proxy_info.is_https()) { |
173 std::string user_agent; | 167 std::string user_agent; |
174 request_extra_headers.GetHeader(HttpRequestHeaders::kUserAgent, | 168 request_extra_headers.GetHeader(HttpRequestHeaders::kUserAgent, |
175 &user_agent); | 169 &user_agent); |
176 scoped_refptr<SSLSocketParams> ssl_params; | 170 scoped_refptr<SSLSocketParams> ssl_params; |
177 if (proxy_info.is_https()) { | 171 if (proxy_info.is_https()) { |
172 // Enable TCP FastOpen for SSL sockets. | |
173 // TODO (jri): Finch trial this. | |
174 proxy_tcp_params->enable_use_tcp_fastopen(); | |
178 // Set ssl_params, and unset proxy_tcp_params | 175 // Set ssl_params, and unset proxy_tcp_params |
179 ssl_params = new SSLSocketParams(proxy_tcp_params, | 176 ssl_params = new SSLSocketParams(proxy_tcp_params, |
180 NULL, | 177 NULL, |
181 NULL, | 178 NULL, |
182 *proxy_host_port.get(), | 179 *proxy_host_port.get(), |
183 ssl_config_for_proxy, | 180 ssl_config_for_proxy, |
184 PRIVACY_MODE_DISABLED, | 181 PRIVACY_MODE_DISABLED, |
185 load_flags, | 182 load_flags, |
186 force_spdy_over_ssl, | 183 force_spdy_over_ssl, |
187 want_spdy_over_npn); | 184 want_spdy_over_npn); |
(...skipping 25 matching lines...) Expand all Loading... | |
213 origin_host_port); | 210 origin_host_port); |
214 } | 211 } |
215 } | 212 } |
216 | 213 |
217 // Change group name if privacy mode is enabled. | 214 // Change group name if privacy mode is enabled. |
218 if (privacy_mode == PRIVACY_MODE_ENABLED) | 215 if (privacy_mode == PRIVACY_MODE_ENABLED) |
219 connection_group = "pm/" + connection_group; | 216 connection_group = "pm/" + connection_group; |
220 | 217 |
221 // Deal with SSL - which layers on top of any given proxy. | 218 // Deal with SSL - which layers on top of any given proxy. |
222 if (using_ssl) { | 219 if (using_ssl) { |
220 scoped_refptr<TransportSocketParams> ssl_tcp_params = | |
221 new TransportSocketParams(origin_host_port, | |
222 disable_resolver_cache, | |
223 ignore_limits, | |
224 resolution_callback); | |
225 // Enable TCP FastOpen for SSL socket. | |
226 // TODO (jri): Finch trial this. | |
227 ssl_tcp_params->enable_use_tcp_fastopen(); | |
223 scoped_refptr<SSLSocketParams> ssl_params = | 228 scoped_refptr<SSLSocketParams> ssl_params = |
224 new SSLSocketParams(tcp_params, | 229 new SSLSocketParams(ssl_tcp_params, |
225 socks_params, | 230 socks_params, |
226 http_proxy_params, | 231 http_proxy_params, |
227 origin_host_port, | 232 origin_host_port, |
228 ssl_config_for_origin, | 233 ssl_config_for_origin, |
229 privacy_mode, | 234 privacy_mode, |
230 load_flags, | 235 load_flags, |
231 force_spdy_over_ssl, | 236 force_spdy_over_ssl, |
232 want_spdy_over_npn); | 237 want_spdy_over_npn); |
233 SSLClientSocketPool* ssl_pool = NULL; | 238 SSLClientSocketPool* ssl_pool = NULL; |
234 if (proxy_info.is_direct()) { | 239 if (proxy_info.is_direct()) { |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
273 num_preconnect_streams, net_log); | 278 num_preconnect_streams, net_log); |
274 return OK; | 279 return OK; |
275 } | 280 } |
276 | 281 |
277 return socket_handle->Init(connection_group, socks_params, | 282 return socket_handle->Init(connection_group, socks_params, |
278 request_priority, callback, pool, | 283 request_priority, callback, pool, |
279 net_log); | 284 net_log); |
280 } | 285 } |
281 | 286 |
282 DCHECK(proxy_info.is_direct()); | 287 DCHECK(proxy_info.is_direct()); |
283 | 288 scoped_refptr<TransportSocketParams> tcp_params = |
289 new TransportSocketParams(origin_host_port, | |
290 disable_resolver_cache, | |
291 ignore_limits, | |
292 resolution_callback); | |
mmenke
2014/08/14 17:56:03
Shouldn't we be enabling fastopen if g_tcp_fastope
mmenke
2014/08/14 17:56:03
nit: +2 indent
Jana
2014/08/15 20:00:06
Yes -- but the global is being used on *all* socke
Jana
2014/08/16 00:01:11
Sorry, I seem to have left this sentence hanging.
| |
284 TransportClientSocketPool* pool = | 293 TransportClientSocketPool* pool = |
285 session->GetTransportSocketPool(socket_pool_type); | 294 session->GetTransportSocketPool(socket_pool_type); |
286 if (num_preconnect_streams) { | 295 if (num_preconnect_streams) { |
287 RequestSocketsForPool(pool, connection_group, tcp_params, | 296 RequestSocketsForPool(pool, connection_group, tcp_params, |
288 num_preconnect_streams, net_log); | 297 num_preconnect_streams, net_log); |
289 return OK; | 298 return OK; |
290 } | 299 } |
291 | 300 |
292 return socket_handle->Init(connection_group, tcp_params, | 301 return socket_handle->Init(connection_group, tcp_params, |
293 request_priority, callback, | 302 request_priority, callback, |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
477 int num_preconnect_streams) { | 486 int num_preconnect_streams) { |
478 return InitSocketPoolHelper( | 487 return InitSocketPoolHelper( |
479 request_url, request_extra_headers, request_load_flags, request_priority, | 488 request_url, request_extra_headers, request_load_flags, request_priority, |
480 session, proxy_info, force_spdy_over_ssl, want_spdy_over_npn, | 489 session, proxy_info, force_spdy_over_ssl, want_spdy_over_npn, |
481 ssl_config_for_origin, ssl_config_for_proxy, false, privacy_mode, net_log, | 490 ssl_config_for_origin, ssl_config_for_proxy, false, privacy_mode, net_log, |
482 num_preconnect_streams, NULL, HttpNetworkSession::NORMAL_SOCKET_POOL, | 491 num_preconnect_streams, NULL, HttpNetworkSession::NORMAL_SOCKET_POOL, |
483 OnHostResolutionCallback(), CompletionCallback()); | 492 OnHostResolutionCallback(), CompletionCallback()); |
484 } | 493 } |
485 | 494 |
486 } // namespace net | 495 } // namespace net |
OLD | NEW |