| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/cronet/url_request_context_config.h" | 5 #include "components/cronet/url_request_context_config.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 const char kHostResolverRulesFieldTrialName[] = "HostResolverRules"; | 82 const char kHostResolverRulesFieldTrialName[] = "HostResolverRules"; |
| 83 const char kHostResolverRules[] = "host_resolver_rules"; | 83 const char kHostResolverRules[] = "host_resolver_rules"; |
| 84 | 84 |
| 85 // Disable IPv6. This should almost never be necessary because the network stack | 85 // Disable IPv6. This should almost never be necessary because the network stack |
| 86 // has IPv6 detection logic. Please do not turn on this option without first | 86 // has IPv6 detection logic. Please do not turn on this option without first |
| 87 // reporting a bug. See http://crbug.com/696569 for the currently known issue. | 87 // reporting a bug. See http://crbug.com/696569 for the currently known issue. |
| 88 const char kDisableIPv6[] = "disable_ipv6"; | 88 const char kDisableIPv6[] = "disable_ipv6"; |
| 89 | 89 |
| 90 const char kSSLKeyLogFile[] = "ssl_key_log_file"; | 90 const char kSSLKeyLogFile[] = "ssl_key_log_file"; |
| 91 | 91 |
| 92 // Returns the effective experimental options. | 92 void ParseAndSetExperimentalOptions( |
| 93 std::unique_ptr<base::DictionaryValue> ParseAndSetExperimentalOptions( | |
| 94 const std::string& experimental_options, | 93 const std::string& experimental_options, |
| 95 net::URLRequestContextBuilder* context_builder, | 94 net::URLRequestContextBuilder* context_builder, |
| 96 net::NetLog* net_log, | 95 net::NetLog* net_log, |
| 97 const scoped_refptr<base::SequencedTaskRunner>& file_task_runner) { | 96 const scoped_refptr<base::SequencedTaskRunner>& file_task_runner) { |
| 98 if (experimental_options.empty()) | 97 if (experimental_options.empty()) |
| 99 return nullptr; | 98 return; |
| 100 | 99 |
| 101 DCHECK(net_log); | 100 DCHECK(net_log); |
| 102 | 101 |
| 103 DVLOG(1) << "Experimental Options:" << experimental_options; | 102 DVLOG(1) << "Experimental Options:" << experimental_options; |
| 104 std::unique_ptr<base::Value> options = | 103 std::unique_ptr<base::Value> options = |
| 105 base::JSONReader::Read(experimental_options); | 104 base::JSONReader::Read(experimental_options); |
| 106 | 105 |
| 107 if (!options) { | 106 if (!options) { |
| 108 DCHECK(false) << "Parsing experimental options failed: " | 107 DCHECK(false) << "Parsing experimental options failed: " |
| 109 << experimental_options; | 108 << experimental_options; |
| 110 return nullptr; | 109 return; |
| 111 } | 110 } |
| 112 | 111 |
| 113 std::unique_ptr<base::DictionaryValue> dict = | 112 std::unique_ptr<base::DictionaryValue> dict = |
| 114 base::DictionaryValue::From(std::move(options)); | 113 base::DictionaryValue::From(std::move(options)); |
| 115 | 114 |
| 116 if (!dict) { | 115 if (!dict) { |
| 117 DCHECK(false) << "Experimental options string is not a dictionary: " | 116 DCHECK(false) << "Experimental options string is not a dictionary: " |
| 118 << experimental_options; | 117 << experimental_options; |
| 119 return nullptr; | 118 return; |
| 119 } |
| 120 |
| 121 const base::DictionaryValue* quic_args = nullptr; |
| 122 if (dict->GetDictionary(kQuicFieldTrialName, &quic_args)) { |
| 123 std::string quic_connection_options; |
| 124 if (quic_args->GetString(kQuicConnectionOptions, |
| 125 &quic_connection_options)) { |
| 126 context_builder->set_quic_connection_options( |
| 127 net::ParseQuicConnectionOptions(quic_connection_options)); |
| 128 } |
| 129 |
| 130 // TODO(rtenneti): Delete this option after apps stop using it. |
| 131 // Added this for backward compatibility. |
| 132 bool quic_store_server_configs_in_properties = false; |
| 133 if (quic_args->GetBoolean(kQuicStoreServerConfigsInProperties, |
| 134 &quic_store_server_configs_in_properties)) { |
| 135 context_builder->set_quic_max_server_configs_stored_in_properties( |
| 136 net::kMaxQuicServersToPersist); |
| 137 } |
| 138 |
| 139 int quic_max_server_configs_stored_in_properties = 0; |
| 140 if (quic_args->GetInteger(kQuicMaxServerConfigsStoredInProperties, |
| 141 &quic_max_server_configs_stored_in_properties)) { |
| 142 context_builder->set_quic_max_server_configs_stored_in_properties( |
| 143 static_cast<size_t>(quic_max_server_configs_stored_in_properties)); |
| 144 } |
| 145 |
| 146 bool quic_delay_tcp_race = false; |
| 147 if (quic_args->GetBoolean(kQuicDelayTcpRace, &quic_delay_tcp_race)) { |
| 148 context_builder->set_quic_delay_tcp_race(quic_delay_tcp_race); |
| 149 } |
| 150 |
| 151 int quic_idle_connection_timeout_seconds = 0; |
| 152 if (quic_args->GetInteger(kQuicIdleConnectionTimeoutSeconds, |
| 153 &quic_idle_connection_timeout_seconds)) { |
| 154 context_builder->set_quic_idle_connection_timeout_seconds( |
| 155 quic_idle_connection_timeout_seconds); |
| 156 } |
| 157 |
| 158 std::string quic_host_whitelist; |
| 159 if (quic_args->GetString(kQuicHostWhitelist, &quic_host_whitelist)) { |
| 160 std::unordered_set<std::string> hosts; |
| 161 for (const std::string& host : |
| 162 base::SplitString(quic_host_whitelist, ",", base::TRIM_WHITESPACE, |
| 163 base::SPLIT_WANT_ALL)) { |
| 164 hosts.insert(host); |
| 165 } |
| 166 context_builder->set_quic_host_whitelist(hosts); |
| 167 } |
| 168 |
| 169 bool quic_close_sessions_on_ip_change = false; |
| 170 if (quic_args->GetBoolean(kQuicCloseSessionsOnIpChange, |
| 171 &quic_close_sessions_on_ip_change)) { |
| 172 context_builder->set_quic_close_sessions_on_ip_change( |
| 173 quic_close_sessions_on_ip_change); |
| 174 } |
| 175 |
| 176 bool quic_migrate_sessions_on_network_change = false; |
| 177 if (quic_args->GetBoolean(kQuicMigrateSessionsOnNetworkChange, |
| 178 &quic_migrate_sessions_on_network_change)) { |
| 179 context_builder->set_quic_migrate_sessions_on_network_change( |
| 180 quic_migrate_sessions_on_network_change); |
| 181 } |
| 182 |
| 183 bool quic_prefer_aes = false; |
| 184 if (quic_args->GetBoolean(kQuicPreferAes, &quic_prefer_aes)) { |
| 185 context_builder->set_quic_prefer_aes(quic_prefer_aes); |
| 186 } |
| 187 |
| 188 std::string quic_user_agent_id; |
| 189 if (quic_args->GetString(kQuicUserAgentId, &quic_user_agent_id)) { |
| 190 context_builder->set_quic_user_agent_id(quic_user_agent_id); |
| 191 } |
| 192 |
| 193 bool quic_migrate_sessions_early = false; |
| 194 if (quic_args->GetBoolean(kQuicMigrateSessionsEarly, |
| 195 &quic_migrate_sessions_early)) { |
| 196 context_builder->set_quic_migrate_sessions_early( |
| 197 quic_migrate_sessions_early); |
| 198 } |
| 199 |
| 200 bool quic_disable_bidirectional_streams = false; |
| 201 if (quic_args->GetBoolean(kQuicDisableBidirectionalStreams, |
| 202 &quic_disable_bidirectional_streams)) { |
| 203 context_builder->set_quic_disable_bidirectional_streams( |
| 204 quic_disable_bidirectional_streams); |
| 205 } |
| 206 |
| 207 bool quic_race_cert_verification = false; |
| 208 if (quic_args->GetBoolean(kQuicRaceCertVerification, |
| 209 &quic_race_cert_verification)) { |
| 210 context_builder->set_quic_race_cert_verification( |
| 211 quic_race_cert_verification); |
| 212 } |
| 120 } | 213 } |
| 121 | 214 |
| 122 bool async_dns_enable = false; | 215 bool async_dns_enable = false; |
| 123 bool stale_dns_enable = false; | 216 bool stale_dns_enable = false; |
| 124 bool host_resolver_rules_enable = false; | 217 bool host_resolver_rules_enable = false; |
| 125 bool disable_ipv6 = false; | 218 bool disable_ipv6 = false; |
| 126 StaleHostResolver::StaleOptions stale_dns_options; | 219 StaleHostResolver::StaleOptions stale_dns_options; |
| 127 std::string host_resolver_rules_string; | 220 std::string host_resolver_rules_string; |
| 128 for (base::DictionaryValue::Iterator it(*dict.get()); !it.IsAtEnd(); | 221 |
| 129 it.Advance()) { | 222 const base::DictionaryValue* async_dns_args = nullptr; |
| 130 if (it.key() == kQuicFieldTrialName) { | 223 if (dict->GetDictionary(kAsyncDnsFieldTrialName, &async_dns_args)) |
| 131 const base::DictionaryValue* quic_args = nullptr; | 224 async_dns_args->GetBoolean(kAsyncDnsEnable, &async_dns_enable); |
| 132 if (!it.value().GetAsDictionary(&quic_args)) { | 225 |
| 133 LOG(ERROR) << "Quic config params \"" << it.value() | 226 const base::DictionaryValue* stale_dns_args = nullptr; |
| 134 << "\" is not a dictionary value"; | 227 if (dict->GetDictionary(kStaleDnsFieldTrialName, &stale_dns_args)) { |
| 135 dict->Remove(it.key(), nullptr); | 228 if (stale_dns_args->GetBoolean(kStaleDnsEnable, &stale_dns_enable) && |
| 136 continue; | 229 stale_dns_enable) { |
| 230 int delay; |
| 231 if (stale_dns_args->GetInteger(kStaleDnsDelayMs, &delay)) |
| 232 stale_dns_options.delay = base::TimeDelta::FromMilliseconds(delay); |
| 233 int max_expired_time_ms; |
| 234 if (stale_dns_args->GetInteger(kStaleDnsMaxExpiredTimeMs, |
| 235 &max_expired_time_ms)) { |
| 236 stale_dns_options.max_expired_time = |
| 237 base::TimeDelta::FromMilliseconds(max_expired_time_ms); |
| 137 } | 238 } |
| 138 std::string quic_connection_options; | 239 int max_stale_uses; |
| 139 if (quic_args->GetString(kQuicConnectionOptions, | 240 if (stale_dns_args->GetInteger(kStaleDnsMaxStaleUses, &max_stale_uses)) |
| 140 &quic_connection_options)) { | 241 stale_dns_options.max_stale_uses = max_stale_uses; |
| 141 context_builder->set_quic_connection_options( | 242 bool allow_other_network; |
| 142 net::ParseQuicConnectionOptions(quic_connection_options)); | 243 if (stale_dns_args->GetBoolean(kStaleDnsAllowOtherNetwork, |
| 244 &allow_other_network)) { |
| 245 stale_dns_options.allow_other_network = allow_other_network; |
| 143 } | 246 } |
| 144 | |
| 145 // TODO(rtenneti): Delete this option after apps stop using it. | |
| 146 // Added this for backward compatibility. | |
| 147 bool quic_store_server_configs_in_properties = false; | |
| 148 if (quic_args->GetBoolean(kQuicStoreServerConfigsInProperties, | |
| 149 &quic_store_server_configs_in_properties)) { | |
| 150 context_builder->set_quic_max_server_configs_stored_in_properties( | |
| 151 net::kMaxQuicServersToPersist); | |
| 152 } | |
| 153 | |
| 154 int quic_max_server_configs_stored_in_properties = 0; | |
| 155 if (quic_args->GetInteger( | |
| 156 kQuicMaxServerConfigsStoredInProperties, | |
| 157 &quic_max_server_configs_stored_in_properties)) { | |
| 158 context_builder->set_quic_max_server_configs_stored_in_properties( | |
| 159 static_cast<size_t>(quic_max_server_configs_stored_in_properties)); | |
| 160 } | |
| 161 | |
| 162 bool quic_delay_tcp_race = false; | |
| 163 if (quic_args->GetBoolean(kQuicDelayTcpRace, &quic_delay_tcp_race)) { | |
| 164 context_builder->set_quic_delay_tcp_race(quic_delay_tcp_race); | |
| 165 } | |
| 166 | |
| 167 int quic_idle_connection_timeout_seconds = 0; | |
| 168 if (quic_args->GetInteger(kQuicIdleConnectionTimeoutSeconds, | |
| 169 &quic_idle_connection_timeout_seconds)) { | |
| 170 context_builder->set_quic_idle_connection_timeout_seconds( | |
| 171 quic_idle_connection_timeout_seconds); | |
| 172 } | |
| 173 | |
| 174 std::string quic_host_whitelist; | |
| 175 if (quic_args->GetString(kQuicHostWhitelist, &quic_host_whitelist)) { | |
| 176 std::unordered_set<std::string> hosts; | |
| 177 for (const std::string& host : | |
| 178 base::SplitString(quic_host_whitelist, ",", base::TRIM_WHITESPACE, | |
| 179 base::SPLIT_WANT_ALL)) { | |
| 180 hosts.insert(host); | |
| 181 } | |
| 182 context_builder->set_quic_host_whitelist(hosts); | |
| 183 } | |
| 184 | |
| 185 bool quic_close_sessions_on_ip_change = false; | |
| 186 if (quic_args->GetBoolean(kQuicCloseSessionsOnIpChange, | |
| 187 &quic_close_sessions_on_ip_change)) { | |
| 188 context_builder->set_quic_close_sessions_on_ip_change( | |
| 189 quic_close_sessions_on_ip_change); | |
| 190 } | |
| 191 | |
| 192 bool quic_migrate_sessions_on_network_change = false; | |
| 193 if (quic_args->GetBoolean(kQuicMigrateSessionsOnNetworkChange, | |
| 194 &quic_migrate_sessions_on_network_change)) { | |
| 195 context_builder->set_quic_migrate_sessions_on_network_change( | |
| 196 quic_migrate_sessions_on_network_change); | |
| 197 } | |
| 198 | |
| 199 bool quic_prefer_aes = false; | |
| 200 if (quic_args->GetBoolean(kQuicPreferAes, &quic_prefer_aes)) { | |
| 201 context_builder->set_quic_prefer_aes(quic_prefer_aes); | |
| 202 } | |
| 203 | |
| 204 std::string quic_user_agent_id; | |
| 205 if (quic_args->GetString(kQuicUserAgentId, &quic_user_agent_id)) { | |
| 206 context_builder->set_quic_user_agent_id(quic_user_agent_id); | |
| 207 } | |
| 208 | |
| 209 bool quic_migrate_sessions_early = false; | |
| 210 if (quic_args->GetBoolean(kQuicMigrateSessionsEarly, | |
| 211 &quic_migrate_sessions_early)) { | |
| 212 context_builder->set_quic_migrate_sessions_early( | |
| 213 quic_migrate_sessions_early); | |
| 214 } | |
| 215 | |
| 216 bool quic_disable_bidirectional_streams = false; | |
| 217 if (quic_args->GetBoolean(kQuicDisableBidirectionalStreams, | |
| 218 &quic_disable_bidirectional_streams)) { | |
| 219 context_builder->set_quic_disable_bidirectional_streams( | |
| 220 quic_disable_bidirectional_streams); | |
| 221 } | |
| 222 | |
| 223 bool quic_race_cert_verification = false; | |
| 224 if (quic_args->GetBoolean(kQuicRaceCertVerification, | |
| 225 &quic_race_cert_verification)) { | |
| 226 context_builder->set_quic_race_cert_verification( | |
| 227 quic_race_cert_verification); | |
| 228 } | |
| 229 } else if (it.key() == kAsyncDnsFieldTrialName) { | |
| 230 const base::DictionaryValue* async_dns_args = nullptr; | |
| 231 if (!it.value().GetAsDictionary(&async_dns_args)) { | |
| 232 LOG(ERROR) << "\"" << it.key() << "\" config params \"" << it.value() | |
| 233 << "\" is not a dictionary value"; | |
| 234 dict->Remove(it.key(), nullptr); | |
| 235 continue; | |
| 236 } | |
| 237 async_dns_args->GetBoolean(kAsyncDnsEnable, &async_dns_enable); | |
| 238 } else if (it.key() == kStaleDnsFieldTrialName) { | |
| 239 const base::DictionaryValue* stale_dns_args = nullptr; | |
| 240 if (!it.value().GetAsDictionary(&stale_dns_args)) { | |
| 241 LOG(ERROR) << "\"" << it.key() << "\" config params \"" << it.value() | |
| 242 << "\" is not a dictionary value"; | |
| 243 dict->Remove(it.key(), nullptr); | |
| 244 continue; | |
| 245 } | |
| 246 if (stale_dns_args->GetBoolean(kStaleDnsEnable, &stale_dns_enable) && | |
| 247 stale_dns_enable) { | |
| 248 int delay; | |
| 249 if (stale_dns_args->GetInteger(kStaleDnsDelayMs, &delay)) | |
| 250 stale_dns_options.delay = base::TimeDelta::FromMilliseconds(delay); | |
| 251 int max_expired_time_ms; | |
| 252 if (stale_dns_args->GetInteger(kStaleDnsMaxExpiredTimeMs, | |
| 253 &max_expired_time_ms)) { | |
| 254 stale_dns_options.max_expired_time = | |
| 255 base::TimeDelta::FromMilliseconds(max_expired_time_ms); | |
| 256 } | |
| 257 int max_stale_uses; | |
| 258 if (stale_dns_args->GetInteger(kStaleDnsMaxStaleUses, &max_stale_uses)) | |
| 259 stale_dns_options.max_stale_uses = max_stale_uses; | |
| 260 bool allow_other_network; | |
| 261 if (stale_dns_args->GetBoolean(kStaleDnsAllowOtherNetwork, | |
| 262 &allow_other_network)) { | |
| 263 stale_dns_options.allow_other_network = allow_other_network; | |
| 264 } | |
| 265 } | |
| 266 } else if (it.key() == kHostResolverRulesFieldTrialName) { | |
| 267 const base::DictionaryValue* host_resolver_rules_args = nullptr; | |
| 268 if (!it.value().GetAsDictionary(&host_resolver_rules_args)) { | |
| 269 LOG(ERROR) << "\"" << it.key() << "\" config params \"" << it.value() | |
| 270 << "\" is not a dictionary value"; | |
| 271 dict->Remove(it.key(), nullptr); | |
| 272 continue; | |
| 273 } | |
| 274 host_resolver_rules_enable = host_resolver_rules_args->GetString( | |
| 275 kHostResolverRules, &host_resolver_rules_string); | |
| 276 } else if (it.key() == kDisableIPv6) { | |
| 277 if (!it.value().GetAsBoolean(&disable_ipv6)) { | |
| 278 LOG(ERROR) << "\"" << it.key() << "\" config params \"" << it.value() | |
| 279 << "\" is not a bool"; | |
| 280 dict->Remove(it.key(), nullptr); | |
| 281 continue; | |
| 282 } | |
| 283 } else if (it.key() == kSSLKeyLogFile) { | |
| 284 std::string ssl_key_log_file_string; | |
| 285 if (it.value().GetAsString(&ssl_key_log_file_string)) { | |
| 286 DCHECK(file_task_runner); | |
| 287 base::FilePath ssl_key_log_file(ssl_key_log_file_string); | |
| 288 if (!ssl_key_log_file.empty() && file_task_runner) { | |
| 289 // SetSSLKeyLogFile is only safe to call before any SSLClientSockets | |
| 290 // are created. This should not be used if there are multiple | |
| 291 // CronetEngine. | |
| 292 // TODO(xunjieli): Expose this as a stable API after crbug.com/458365 | |
| 293 // is resolved. | |
| 294 net::SSLClientSocket::SetSSLKeyLogFile(ssl_key_log_file, | |
| 295 file_task_runner); | |
| 296 } | |
| 297 } | |
| 298 } else { | |
| 299 LOG(WARNING) << "Unrecognized Cronet experimental option \"" << it.key() | |
| 300 << "\" with params \"" << it.value(); | |
| 301 dict->Remove(it.key(), nullptr); | |
| 302 } | 247 } |
| 303 } | 248 } |
| 249 |
| 250 const base::DictionaryValue* host_resolver_rules_args = nullptr; |
| 251 if (dict->GetDictionary(kHostResolverRulesFieldTrialName, |
| 252 &host_resolver_rules_args)) { |
| 253 host_resolver_rules_enable = host_resolver_rules_args->GetString( |
| 254 kHostResolverRules, &host_resolver_rules_string); |
| 255 } |
| 256 |
| 257 dict->GetBoolean(kDisableIPv6, &disable_ipv6); |
| 258 |
| 304 if (async_dns_enable || stale_dns_enable || host_resolver_rules_enable || | 259 if (async_dns_enable || stale_dns_enable || host_resolver_rules_enable || |
| 305 disable_ipv6) { | 260 disable_ipv6) { |
| 306 CHECK(net_log) << "All DNS-related experiments require NetLog."; | 261 if (net_log == nullptr) { |
| 262 CHECK(false) << "All DNS-related experiments require NetLog."; |
| 263 } |
| 307 std::unique_ptr<net::HostResolver> host_resolver; | 264 std::unique_ptr<net::HostResolver> host_resolver; |
| 308 if (stale_dns_enable) { | 265 if (stale_dns_enable) { |
| 309 DCHECK(!disable_ipv6); | 266 DCHECK(!disable_ipv6); |
| 310 host_resolver.reset(new StaleHostResolver( | 267 host_resolver.reset(new StaleHostResolver( |
| 311 net::HostResolver::CreateDefaultResolverImpl(net_log), | 268 net::HostResolver::CreateDefaultResolverImpl(net_log), |
| 312 stale_dns_options)); | 269 stale_dns_options)); |
| 313 } else { | 270 } else { |
| 314 host_resolver = net::HostResolver::CreateDefaultResolver(net_log); | 271 host_resolver = net::HostResolver::CreateDefaultResolver(net_log); |
| 315 } | 272 } |
| 316 if (disable_ipv6) | 273 if (disable_ipv6) |
| 317 host_resolver->SetDefaultAddressFamily(net::ADDRESS_FAMILY_IPV4); | 274 host_resolver->SetDefaultAddressFamily(net::ADDRESS_FAMILY_IPV4); |
| 318 if (async_dns_enable) | 275 if (async_dns_enable) |
| 319 host_resolver->SetDnsClientEnabled(true); | 276 host_resolver->SetDnsClientEnabled(true); |
| 320 if (host_resolver_rules_enable) { | 277 if (host_resolver_rules_enable) { |
| 321 std::unique_ptr<net::MappedHostResolver> remapped_resolver( | 278 std::unique_ptr<net::MappedHostResolver> remapped_resolver( |
| 322 new net::MappedHostResolver(std::move(host_resolver))); | 279 new net::MappedHostResolver(std::move(host_resolver))); |
| 323 remapped_resolver->SetRulesFromString(host_resolver_rules_string); | 280 remapped_resolver->SetRulesFromString(host_resolver_rules_string); |
| 324 host_resolver = std::move(remapped_resolver); | 281 host_resolver = std::move(remapped_resolver); |
| 325 } | 282 } |
| 326 context_builder->set_host_resolver(std::move(host_resolver)); | 283 context_builder->set_host_resolver(std::move(host_resolver)); |
| 327 } | 284 } |
| 328 return dict; | 285 |
| 286 std::string ssl_key_log_file_string; |
| 287 if (dict->GetString(kSSLKeyLogFile, &ssl_key_log_file_string)) { |
| 288 DCHECK(file_task_runner); |
| 289 base::FilePath ssl_key_log_file(ssl_key_log_file_string); |
| 290 if (!ssl_key_log_file.empty() && file_task_runner) { |
| 291 // SetSSLKeyLogFile is only safe to call before any SSLClientSockets are |
| 292 // created. This should not be used if there are multiple CronetEngine. |
| 293 // TODO(xunjieli): Expose this as a stable API after crbug.com/458365 is |
| 294 // resolved. |
| 295 net::SSLClientSocket::SetSSLKeyLogFile(ssl_key_log_file, |
| 296 file_task_runner); |
| 297 } |
| 298 } |
| 329 } | 299 } |
| 330 | 300 |
| 331 } // namespace | 301 } // namespace |
| 332 | 302 |
| 333 URLRequestContextConfig::QuicHint::QuicHint(const std::string& host, | 303 URLRequestContextConfig::QuicHint::QuicHint(const std::string& host, |
| 334 int port, | 304 int port, |
| 335 int alternate_port) | 305 int alternate_port) |
| 336 : host(host), port(port), alternate_port(alternate_port) {} | 306 : host(host), port(port), alternate_port(alternate_port) {} |
| 337 | 307 |
| 338 URLRequestContextConfig::QuicHint::~QuicHint() {} | 308 URLRequestContextConfig::QuicHint::~QuicHint() {} |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 410 context_builder->EnableHttpCache(cache_params); | 380 context_builder->EnableHttpCache(cache_params); |
| 411 } else { | 381 } else { |
| 412 context_builder->DisableHttpCache(); | 382 context_builder->DisableHttpCache(); |
| 413 } | 383 } |
| 414 context_builder->set_user_agent(user_agent); | 384 context_builder->set_user_agent(user_agent); |
| 415 context_builder->SetSpdyAndQuicEnabled(enable_spdy, enable_quic); | 385 context_builder->SetSpdyAndQuicEnabled(enable_spdy, enable_quic); |
| 416 context_builder->set_sdch_enabled(enable_sdch); | 386 context_builder->set_sdch_enabled(enable_sdch); |
| 417 if (enable_quic) | 387 if (enable_quic) |
| 418 context_builder->set_quic_user_agent_id(quic_user_agent_id); | 388 context_builder->set_quic_user_agent_id(quic_user_agent_id); |
| 419 | 389 |
| 420 effective_experimental_options = ParseAndSetExperimentalOptions( | 390 ParseAndSetExperimentalOptions(experimental_options, context_builder, net_log, |
| 421 experimental_options, context_builder, net_log, file_task_runner); | 391 file_task_runner); |
| 422 | 392 |
| 423 std::unique_ptr<net::CertVerifier> cert_verifier; | 393 std::unique_ptr<net::CertVerifier> cert_verifier; |
| 424 if (mock_cert_verifier) { | 394 if (mock_cert_verifier) { |
| 425 // Because |context_builder| expects CachingCertVerifier, wrap | 395 // Because |context_builder| expects CachingCertVerifier, wrap |
| 426 // |mock_cert_verifier| into a CachingCertVerifier. | 396 // |mock_cert_verifier| into a CachingCertVerifier. |
| 427 cert_verifier = base::MakeUnique<net::CachingCertVerifier>( | 397 cert_verifier = base::MakeUnique<net::CachingCertVerifier>( |
| 428 std::move(mock_cert_verifier)); | 398 std::move(mock_cert_verifier)); |
| 429 } else { | 399 } else { |
| 430 // net::CertVerifier::CreateDefault() returns a CachingCertVerifier. | 400 // net::CertVerifier::CreateDefault() returns a CachingCertVerifier. |
| 431 cert_verifier = net::CertVerifier::CreateDefault(); | 401 cert_verifier = net::CertVerifier::CreateDefault(); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 443 enable_quic, quic_user_agent_id, enable_spdy, enable_sdch, http_cache, | 413 enable_quic, quic_user_agent_id, enable_spdy, enable_sdch, http_cache, |
| 444 http_cache_max_size, load_disable_cache, storage_path, user_agent, | 414 http_cache_max_size, load_disable_cache, storage_path, user_agent, |
| 445 experimental_options, data_reduction_proxy_key, | 415 experimental_options, data_reduction_proxy_key, |
| 446 data_reduction_primary_proxy, data_reduction_fallback_proxy, | 416 data_reduction_primary_proxy, data_reduction_fallback_proxy, |
| 447 data_reduction_secure_proxy_check_url, std::move(mock_cert_verifier), | 417 data_reduction_secure_proxy_check_url, std::move(mock_cert_verifier), |
| 448 enable_network_quality_estimator, | 418 enable_network_quality_estimator, |
| 449 bypass_public_key_pinning_for_local_trust_anchors, cert_verifier_data); | 419 bypass_public_key_pinning_for_local_trust_anchors, cert_verifier_data); |
| 450 } | 420 } |
| 451 | 421 |
| 452 } // namespace cronet | 422 } // namespace cronet |
| OLD | NEW |