| 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/http/http_network_session.h" | 5 #include "net/http/http_network_session.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/atomic_sequence_num.h" | 9 #include "base/atomic_sequence_num.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 | 65 |
| 66 // The maximum receive window sizes for HTTP/2 sessions and streams. | 66 // The maximum receive window sizes for HTTP/2 sessions and streams. |
| 67 const int32_t kSpdySessionMaxRecvWindowSize = 15 * 1024 * 1024; // 15 MB | 67 const int32_t kSpdySessionMaxRecvWindowSize = 15 * 1024 * 1024; // 15 MB |
| 68 const int32_t kSpdyStreamMaxRecvWindowSize = 6 * 1024 * 1024; // 6 MB | 68 const int32_t kSpdyStreamMaxRecvWindowSize = 6 * 1024 * 1024; // 6 MB |
| 69 // QUIC's socket receive buffer size. | 69 // QUIC's socket receive buffer size. |
| 70 // We should adaptively set this buffer size, but for now, we'll use a size | 70 // We should adaptively set this buffer size, but for now, we'll use a size |
| 71 // that seems large enough to receive data at line rate for most connections, | 71 // that seems large enough to receive data at line rate for most connections, |
| 72 // and does not consume "too much" memory. | 72 // and does not consume "too much" memory. |
| 73 const int32_t kQuicSocketReceiveBufferSize = 1024 * 1024; // 1MB | 73 const int32_t kQuicSocketReceiveBufferSize = 1024 * 1024; // 1MB |
| 74 | 74 |
| 75 namespace { |
| 76 |
| 77 // Keep all HTTP2 parameters in |http2_settings|, even the ones that are not |
| 78 // implemented, to be sent to the server. |
| 79 // Set default values for settings that |http2_settings| does not specify. |
| 80 SettingsMap AddDefaultHttp2Settings(SettingsMap http2_settings) { |
| 81 // Set default values only if |http2_settings| does not have |
| 82 // a value set for given setting. |
| 83 SettingsMap::iterator it = http2_settings.find(SETTINGS_HEADER_TABLE_SIZE); |
| 84 if (it == http2_settings.end()) |
| 85 http2_settings[SETTINGS_HEADER_TABLE_SIZE] = kSpdyMaxHeaderTableSize; |
| 86 |
| 87 it = http2_settings.find(SETTINGS_MAX_CONCURRENT_STREAMS); |
| 88 if (it == http2_settings.end()) |
| 89 http2_settings[SETTINGS_MAX_CONCURRENT_STREAMS] = |
| 90 kSpdyMaxConcurrentPushedStreams; |
| 91 |
| 92 it = http2_settings.find(SETTINGS_INITIAL_WINDOW_SIZE); |
| 93 if (it == http2_settings.end()) |
| 94 http2_settings[SETTINGS_INITIAL_WINDOW_SIZE] = kSpdyStreamMaxRecvWindowSize; |
| 95 |
| 96 return http2_settings; |
| 97 } |
| 98 |
| 99 } // unnamed namespace |
| 100 |
| 75 HttpNetworkSession::Params::Params() | 101 HttpNetworkSession::Params::Params() |
| 76 : client_socket_factory(NULL), | 102 : client_socket_factory(NULL), |
| 77 host_resolver(NULL), | 103 host_resolver(NULL), |
| 78 cert_verifier(NULL), | 104 cert_verifier(NULL), |
| 79 channel_id_service(NULL), | 105 channel_id_service(NULL), |
| 80 transport_security_state(NULL), | 106 transport_security_state(NULL), |
| 81 cert_transparency_verifier(NULL), | 107 cert_transparency_verifier(NULL), |
| 82 ct_policy_enforcer(NULL), | 108 ct_policy_enforcer(NULL), |
| 83 proxy_service(NULL), | 109 proxy_service(NULL), |
| 84 ssl_config_service(NULL), | 110 ssl_config_service(NULL), |
| 85 http_auth_handler_factory(NULL), | 111 http_auth_handler_factory(NULL), |
| 86 net_log(NULL), | 112 net_log(NULL), |
| 87 host_mapping_rules(NULL), | 113 host_mapping_rules(NULL), |
| 88 socket_performance_watcher_factory(NULL), | 114 socket_performance_watcher_factory(NULL), |
| 89 ignore_certificate_errors(false), | 115 ignore_certificate_errors(false), |
| 90 testing_fixed_http_port(0), | 116 testing_fixed_http_port(0), |
| 91 testing_fixed_https_port(0), | 117 testing_fixed_https_port(0), |
| 92 enable_tcp_fast_open_for_ssl(false), | 118 enable_tcp_fast_open_for_ssl(false), |
| 93 enable_spdy_ping_based_connection_checking(true), | 119 enable_spdy_ping_based_connection_checking(true), |
| 94 enable_http2(true), | 120 enable_http2(true), |
| 95 spdy_session_max_recv_window_size(kSpdySessionMaxRecvWindowSize), | 121 spdy_session_max_recv_window_size(kSpdySessionMaxRecvWindowSize), |
| 96 spdy_stream_max_recv_window_size(kSpdyStreamMaxRecvWindowSize), | |
| 97 time_func(&base::TimeTicks::Now), | 122 time_func(&base::TimeTicks::Now), |
| 98 enable_http2_alternative_service_with_different_host(false), | 123 enable_http2_alternative_service_with_different_host(false), |
| 99 enable_quic_alternative_service_with_different_host(true), | 124 enable_quic_alternative_service_with_different_host(true), |
| 100 enable_quic(false), | 125 enable_quic(false), |
| 101 disable_quic_on_timeout_with_open_streams(false), | 126 disable_quic_on_timeout_with_open_streams(false), |
| 102 quic_always_require_handshake_confirmation(false), | 127 quic_always_require_handshake_confirmation(false), |
| 103 quic_disable_connection_pooling(false), | 128 quic_disable_connection_pooling(false), |
| 104 quic_load_server_info_timeout_srtt_multiplier(0.25f), | 129 quic_load_server_info_timeout_srtt_multiplier(0.25f), |
| 105 quic_enable_connection_racing(false), | 130 quic_enable_connection_racing(false), |
| 106 quic_enable_non_blocking_io(false), | 131 quic_enable_non_blocking_io(false), |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 params.quic_race_cert_verification, | 215 params.quic_race_cert_verification, |
| 191 params.quic_do_not_fragment, | 216 params.quic_do_not_fragment, |
| 192 params.quic_connection_options, | 217 params.quic_connection_options, |
| 193 params.enable_token_binding), | 218 params.enable_token_binding), |
| 194 spdy_session_pool_(params.host_resolver, | 219 spdy_session_pool_(params.host_resolver, |
| 195 params.ssl_config_service, | 220 params.ssl_config_service, |
| 196 params.http_server_properties, | 221 params.http_server_properties, |
| 197 params.transport_security_state, | 222 params.transport_security_state, |
| 198 params.enable_spdy_ping_based_connection_checking, | 223 params.enable_spdy_ping_based_connection_checking, |
| 199 params.spdy_session_max_recv_window_size, | 224 params.spdy_session_max_recv_window_size, |
| 200 params.spdy_stream_max_recv_window_size, | 225 AddDefaultHttp2Settings(params.http2_settings), |
| 201 params.time_func, | 226 params.time_func, |
| 202 params.proxy_delegate), | 227 params.proxy_delegate), |
| 203 http_stream_factory_(new HttpStreamFactoryImpl(this, false)), | 228 http_stream_factory_(new HttpStreamFactoryImpl(this, false)), |
| 204 http_stream_factory_for_websocket_(new HttpStreamFactoryImpl(this, true)), | 229 http_stream_factory_for_websocket_(new HttpStreamFactoryImpl(this, true)), |
| 205 network_stream_throttler_(new NetworkThrottleManagerImpl()), | 230 network_stream_throttler_(new NetworkThrottleManagerImpl()), |
| 206 params_(params) { | 231 params_(params) { |
| 207 DCHECK(proxy_service_); | 232 DCHECK(proxy_service_); |
| 208 DCHECK(ssl_config_service_.get()); | 233 DCHECK(ssl_config_service_.get()); |
| 209 CHECK(http_server_properties_); | 234 CHECK(http_server_properties_); |
| 210 | 235 |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 break; | 478 break; |
| 454 case base::MemoryState::SUSPENDED: | 479 case base::MemoryState::SUSPENDED: |
| 455 // Note: Not supported at present. Fall through. | 480 // Note: Not supported at present. Fall through. |
| 456 case base::MemoryState::UNKNOWN: | 481 case base::MemoryState::UNKNOWN: |
| 457 NOTREACHED(); | 482 NOTREACHED(); |
| 458 break; | 483 break; |
| 459 } | 484 } |
| 460 } | 485 } |
| 461 | 486 |
| 462 } // namespace net | 487 } // namespace net |
| OLD | NEW |