OLD | NEW |
---|---|
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/ios/cronet_environment.h" | 5 #include "components/cronet/ios/cronet_environment.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/at_exit.h" | 9 #include "base/at_exit.h" |
10 #include "base/atomicops.h" | 10 #include "base/atomicops.h" |
(...skipping 23 matching lines...) Expand all Loading... | |
34 #include "net/dns/host_resolver.h" | 34 #include "net/dns/host_resolver.h" |
35 #include "net/dns/mapped_host_resolver.h" | 35 #include "net/dns/mapped_host_resolver.h" |
36 #include "net/http/http_server_properties_impl.h" | 36 #include "net/http/http_server_properties_impl.h" |
37 #include "net/http/http_stream_factory.h" | 37 #include "net/http/http_stream_factory.h" |
38 #include "net/http/http_transaction_factory.h" | 38 #include "net/http/http_transaction_factory.h" |
39 #include "net/http/http_util.h" | 39 #include "net/http/http_util.h" |
40 #include "net/log/net_log.h" | 40 #include "net/log/net_log.h" |
41 #include "net/log/net_log_capture_mode.h" | 41 #include "net/log/net_log_capture_mode.h" |
42 #include "net/log/write_to_file_net_log_observer.h" | 42 #include "net/log/write_to_file_net_log_observer.h" |
43 #include "net/proxy/proxy_service.h" | 43 #include "net/proxy/proxy_service.h" |
44 #include "net/quic/core/quic_versions.h" | |
44 #include "net/socket/ssl_client_socket.h" | 45 #include "net/socket/ssl_client_socket.h" |
45 #include "net/ssl/channel_id_service.h" | 46 #include "net/ssl/channel_id_service.h" |
46 #include "net/url_request/http_user_agent_settings.h" | 47 #include "net/url_request/http_user_agent_settings.h" |
47 #include "net/url_request/url_request_context.h" | 48 #include "net/url_request/url_request_context.h" |
48 #include "net/url_request/url_request_context_builder.h" | 49 #include "net/url_request/url_request_context_builder.h" |
49 #include "net/url_request/url_request_context_storage.h" | 50 #include "net/url_request/url_request_context_storage.h" |
50 #include "net/url_request/url_request_job_factory_impl.h" | 51 #include "net/url_request/url_request_job_factory_impl.h" |
51 #include "url/scheme_host_port.h" | 52 #include "url/scheme_host_port.h" |
52 #include "url/url_util.h" | 53 #include "url/url_util.h" |
53 | 54 |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
318 // of changing it. | 319 // of changing it. |
319 [[NSHTTPCookieStorage sharedHTTPCookieStorage] | 320 [[NSHTTPCookieStorage sharedHTTPCookieStorage] |
320 setCookieAcceptPolicy:NSHTTPCookieAcceptPolicyAlways]; | 321 setCookieAcceptPolicy:NSHTTPCookieAcceptPolicyAlways]; |
321 std::unique_ptr<net::CookieStore> cookie_store = | 322 std::unique_ptr<net::CookieStore> cookie_store = |
322 base::MakeUnique<net::CookieStoreIOS>( | 323 base::MakeUnique<net::CookieStoreIOS>( |
323 [NSHTTPCookieStorage sharedHTTPCookieStorage]); | 324 [NSHTTPCookieStorage sharedHTTPCookieStorage]); |
324 context_builder.SetCookieAndChannelIdStores(std::move(cookie_store), nullptr); | 325 context_builder.SetCookieAndChannelIdStores(std::move(cookie_store), nullptr); |
325 | 326 |
326 std::unique_ptr<net::HttpServerProperties> http_server_properties( | 327 std::unique_ptr<net::HttpServerProperties> http_server_properties( |
327 new net::HttpServerPropertiesImpl()); | 328 new net::HttpServerPropertiesImpl()); |
329 QuicVersionVector advertised_versions; | |
330 HttpNetworkSession::Params* params = | |
331 context_builder.GetNetworkSessionParams(); | |
332 if (params) { | |
333 advertised_versions = params->quic_supported_versions; | |
334 } else { | |
335 advertised_versions = CurrentSupportedVersions(); | |
336 } | |
337 | |
328 for (const auto& quic_hint : quic_hints_) { | 338 for (const auto& quic_hint : quic_hints_) { |
329 net::AlternativeService alternative_service(net::kProtoQUIC, "", | 339 net::AlternativeService alternative_service(net::kProtoQUIC, "", |
330 quic_hint.port()); | 340 quic_hint.port()); |
331 url::SchemeHostPort quic_hint_server("https", quic_hint.host(), | 341 url::SchemeHostPort quic_hint_server("https", quic_hint.host(), |
332 quic_hint.port()); | 342 quic_hint.port()); |
333 http_server_properties->SetAlternativeService( | 343 http_server_properties->SetQuicAlternativeService( |
Bence
2017/06/16 14:43:40
I believe this should also be called with an empty
Zhongyi Shi
2017/06/20 23:23:37
Acknowledged.
| |
334 quic_hint_server, alternative_service, base::Time::Max()); | 344 quic_hint_server, alternative_service, base::Time::Max(), |
345 advertised_versions); | |
335 } | 346 } |
336 | 347 |
337 context_builder.SetHttpServerProperties(std::move(http_server_properties)); | 348 context_builder.SetHttpServerProperties(std::move(http_server_properties)); |
338 | 349 |
339 main_context_ = context_builder.Build(); | 350 main_context_ = context_builder.Build(); |
340 } | 351 } |
341 | 352 |
342 std::string CronetEnvironment::user_agent() { | 353 std::string CronetEnvironment::user_agent() { |
343 const net::HttpUserAgentSettings* user_agent_settings = | 354 const net::HttpUserAgentSettings* user_agent_settings = |
344 main_context_->http_user_agent_settings(); | 355 main_context_->http_user_agent_settings(); |
(...skipping 30 matching lines...) Expand all Loading... | |
375 event->Signal(); | 386 event->Signal(); |
376 } | 387 } |
377 | 388 |
378 std::string CronetEnvironment::getDefaultQuicUserAgentId() const { | 389 std::string CronetEnvironment::getDefaultQuicUserAgentId() const { |
379 return base::SysNSStringToUTF8([[NSBundle mainBundle] | 390 return base::SysNSStringToUTF8([[NSBundle mainBundle] |
380 objectForInfoDictionaryKey:@"CFBundleDisplayName"]) + | 391 objectForInfoDictionaryKey:@"CFBundleDisplayName"]) + |
381 " Cronet/" + CRONET_VERSION; | 392 " Cronet/" + CRONET_VERSION; |
382 } | 393 } |
383 | 394 |
384 } // namespace cronet | 395 } // namespace cronet |
OLD | NEW |