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 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 // of changing it. | 327 // of changing it. |
327 [[NSHTTPCookieStorage sharedHTTPCookieStorage] | 328 [[NSHTTPCookieStorage sharedHTTPCookieStorage] |
328 setCookieAcceptPolicy:NSHTTPCookieAcceptPolicyAlways]; | 329 setCookieAcceptPolicy:NSHTTPCookieAcceptPolicyAlways]; |
329 std::unique_ptr<net::CookieStore> cookie_store = | 330 std::unique_ptr<net::CookieStore> cookie_store = |
330 base::MakeUnique<net::CookieStoreIOS>( | 331 base::MakeUnique<net::CookieStoreIOS>( |
331 [NSHTTPCookieStorage sharedHTTPCookieStorage]); | 332 [NSHTTPCookieStorage sharedHTTPCookieStorage]); |
332 context_builder.SetCookieAndChannelIdStores(std::move(cookie_store), nullptr); | 333 context_builder.SetCookieAndChannelIdStores(std::move(cookie_store), nullptr); |
333 | 334 |
334 std::unique_ptr<net::HttpServerProperties> http_server_properties( | 335 std::unique_ptr<net::HttpServerProperties> http_server_properties( |
335 new net::HttpServerPropertiesImpl()); | 336 new net::HttpServerPropertiesImpl()); |
| 337 |
336 for (const auto& quic_hint : quic_hints_) { | 338 for (const auto& quic_hint : quic_hints_) { |
337 net::AlternativeService alternative_service(net::kProtoQUIC, "", | 339 net::AlternativeService alternative_service(net::kProtoQUIC, "", |
338 quic_hint.port()); | 340 quic_hint.port()); |
339 url::SchemeHostPort quic_hint_server("https", quic_hint.host(), | 341 url::SchemeHostPort quic_hint_server("https", quic_hint.host(), |
340 quic_hint.port()); | 342 quic_hint.port()); |
341 http_server_properties->SetAlternativeService( | 343 http_server_properties->SetQuicAlternativeService( |
342 quic_hint_server, alternative_service, base::Time::Max()); | 344 quic_hint_server, alternative_service, base::Time::Max(), |
| 345 net::QuicVersionVector()); |
343 } | 346 } |
344 | 347 |
345 context_builder.SetHttpServerProperties(std::move(http_server_properties)); | 348 context_builder.SetHttpServerProperties(std::move(http_server_properties)); |
346 | 349 |
347 main_context_ = context_builder.Build(); | 350 main_context_ = context_builder.Build(); |
348 | 351 |
349 // Iterate through PKP configuration for every host. | 352 // Iterate through PKP configuration for every host. |
350 for (const auto& pkp : config->pkp_list) { | 353 for (const auto& pkp : config->pkp_list) { |
351 // Add the host pinning. | 354 // Add the host pinning. |
352 main_context_->transport_security_state()->AddHPKP( | 355 main_context_->transport_security_state()->AddHPKP( |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 event->Signal(); | 394 event->Signal(); |
392 } | 395 } |
393 | 396 |
394 std::string CronetEnvironment::getDefaultQuicUserAgentId() const { | 397 std::string CronetEnvironment::getDefaultQuicUserAgentId() const { |
395 return base::SysNSStringToUTF8([[NSBundle mainBundle] | 398 return base::SysNSStringToUTF8([[NSBundle mainBundle] |
396 objectForInfoDictionaryKey:@"CFBundleDisplayName"]) + | 399 objectForInfoDictionaryKey:@"CFBundleDisplayName"]) + |
397 " Cronet/" + CRONET_VERSION; | 400 " Cronet/" + CRONET_VERSION; |
398 } | 401 } |
399 | 402 |
400 } // namespace cronet | 403 } // namespace cronet |
OLD | NEW |