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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
164 ignore_limits, | 164 ignore_limits, |
165 resolution_callback, | 165 resolution_callback, |
166 TransportSocketParams::COMBINE_CONNECT_AND_WRITE_DEFAULT)); | 166 TransportSocketParams::COMBINE_CONNECT_AND_WRITE_DEFAULT)); |
167 | 167 |
168 if (proxy_info.is_http() || proxy_info.is_https()) { | 168 if (proxy_info.is_http() || proxy_info.is_https()) { |
169 std::string user_agent; | 169 std::string user_agent; |
170 request_extra_headers.GetHeader(HttpRequestHeaders::kUserAgent, | 170 request_extra_headers.GetHeader(HttpRequestHeaders::kUserAgent, |
171 &user_agent); | 171 &user_agent); |
172 scoped_refptr<SSLSocketParams> ssl_params; | 172 scoped_refptr<SSLSocketParams> ssl_params; |
173 if (proxy_info.is_https()) { | 173 if (proxy_info.is_https()) { |
174 // TODO (jri): Enable a finch trial to use | 174 // Combine connect and write for SSL sockets in TCP FastOpen |
175 // COMBINE_CONNECT_AND_WRITE_DESIRED for SSL sockets. | 175 // field trial. |
176 proxy_tcp_params = | 176 TransportSocketParams::CombineConnectAndWritePolicy |
177 new TransportSocketParams( | 177 combine_connect_and_write = |
178 *proxy_host_port, | 178 session->params().enable_tcp_fast_open_for_ssl ? |
179 disable_resolver_cache, | 179 TransportSocketParams::COMBINE_CONNECT_AND_WRITE_DESIRED : |
180 ignore_limits, | 180 TransportSocketParams::COMBINE_CONNECT_AND_WRITE_DEFAULT; |
181 resolution_callback, | 181 proxy_tcp_params = new TransportSocketParams(*proxy_host_port, |
182 TransportSocketParams::COMBINE_CONNECT_AND_WRITE_DEFAULT); | 182 disable_resolver_cache, |
183 ignore_limits, | |
184 resolution_callback, | |
185 combine_connect_and_write); | |
183 // Set ssl_params, and unset proxy_tcp_params | 186 // Set ssl_params, and unset proxy_tcp_params |
184 ssl_params = new SSLSocketParams(proxy_tcp_params, | 187 ssl_params = new SSLSocketParams(proxy_tcp_params, |
185 NULL, | 188 NULL, |
186 NULL, | 189 NULL, |
187 *proxy_host_port.get(), | 190 *proxy_host_port.get(), |
188 ssl_config_for_proxy, | 191 ssl_config_for_proxy, |
189 PRIVACY_MODE_DISABLED, | 192 PRIVACY_MODE_DISABLED, |
190 load_flags, | 193 load_flags, |
191 force_spdy_over_ssl, | 194 force_spdy_over_ssl, |
192 want_spdy_over_npn); | 195 want_spdy_over_npn); |
(...skipping 28 matching lines...) Expand all Loading... | |
221 | 224 |
222 // Change group name if privacy mode is enabled. | 225 // Change group name if privacy mode is enabled. |
223 if (privacy_mode == PRIVACY_MODE_ENABLED) | 226 if (privacy_mode == PRIVACY_MODE_ENABLED) |
224 connection_group = "pm/" + connection_group; | 227 connection_group = "pm/" + connection_group; |
225 | 228 |
226 // Deal with SSL - which layers on top of any given proxy. | 229 // Deal with SSL - which layers on top of any given proxy. |
227 if (using_ssl) { | 230 if (using_ssl) { |
228 scoped_refptr<TransportSocketParams> ssl_tcp_params; | 231 scoped_refptr<TransportSocketParams> ssl_tcp_params; |
229 if (proxy_info.is_direct()) { | 232 if (proxy_info.is_direct()) { |
230 // Setup TCP params if non-proxied SSL connection. | 233 // Setup TCP params if non-proxied SSL connection. |
231 // TODO (jri): Enable a finch trial to use | 234 // Combine connect and write for SSL sockets in TCP FastOpen field trial. |
232 // COMBINE_CONNECT_AND_WRITE_DESIRED for SSL sockets. | 235 TransportSocketParams::CombineConnectAndWritePolicy |
233 ssl_tcp_params = | 236 combine_connect_and_write = |
234 new TransportSocketParams( | 237 session->params().enable_tcp_fast_open_for_ssl ? |
235 origin_host_port, | 238 TransportSocketParams::COMBINE_CONNECT_AND_WRITE_DESIRED : |
236 disable_resolver_cache, | 239 TransportSocketParams::COMBINE_CONNECT_AND_WRITE_DEFAULT; |
mmenke
2014/09/10 18:29:08
Optional: You could move combine_connect_and_writ
Jana
2014/09/11 20:04:59
Since it's not a strong preference for you, I'll l
| |
237 ignore_limits, | 240 ssl_tcp_params = new TransportSocketParams(origin_host_port, |
238 resolution_callback, | 241 disable_resolver_cache, |
239 TransportSocketParams::COMBINE_CONNECT_AND_WRITE_DEFAULT); | 242 ignore_limits, |
243 resolution_callback, | |
244 combine_connect_and_write); | |
240 } | 245 } |
241 scoped_refptr<SSLSocketParams> ssl_params = | 246 scoped_refptr<SSLSocketParams> ssl_params = |
242 new SSLSocketParams(ssl_tcp_params, | 247 new SSLSocketParams(ssl_tcp_params, |
243 socks_params, | 248 socks_params, |
244 http_proxy_params, | 249 http_proxy_params, |
245 origin_host_port, | 250 origin_host_port, |
246 ssl_config_for_origin, | 251 ssl_config_for_origin, |
247 privacy_mode, | 252 privacy_mode, |
248 load_flags, | 253 load_flags, |
249 force_spdy_over_ssl, | 254 force_spdy_over_ssl, |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
501 int num_preconnect_streams) { | 506 int num_preconnect_streams) { |
502 return InitSocketPoolHelper( | 507 return InitSocketPoolHelper( |
503 request_url, request_extra_headers, request_load_flags, request_priority, | 508 request_url, request_extra_headers, request_load_flags, request_priority, |
504 session, proxy_info, force_spdy_over_ssl, want_spdy_over_npn, | 509 session, proxy_info, force_spdy_over_ssl, want_spdy_over_npn, |
505 ssl_config_for_origin, ssl_config_for_proxy, false, privacy_mode, net_log, | 510 ssl_config_for_origin, ssl_config_for_proxy, false, privacy_mode, net_log, |
506 num_preconnect_streams, NULL, HttpNetworkSession::NORMAL_SOCKET_POOL, | 511 num_preconnect_streams, NULL, HttpNetworkSession::NORMAL_SOCKET_POOL, |
507 OnHostResolutionCallback(), CompletionCallback()); | 512 OnHostResolutionCallback(), CompletionCallback()); |
508 } | 513 } |
509 | 514 |
510 } // namespace net | 515 } // namespace net |
OLD | NEW |