Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(234)

Side by Side Diff: chrome/browser/io_thread.cc

Issue 2297263002: Revert "Only allow HTTP/0.9 support on default ports." (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/io_thread.h ('k') | chrome/browser/io_thread_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "chrome/browser/io_thread.h" 5 #include "chrome/browser/io_thread.h"
6 6
7 #include <utility> 7 #include <utility>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/base64.h" 10 #include "base/base64.h"
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 // dependencies and (2) make IOThread more flexible for testing. 311 // dependencies and (2) make IOThread more flexible for testing.
312 IOThread::IOThread( 312 IOThread::IOThread(
313 PrefService* local_state, 313 PrefService* local_state,
314 policy::PolicyService* policy_service, 314 policy::PolicyService* policy_service,
315 net_log::ChromeNetLog* net_log, 315 net_log::ChromeNetLog* net_log,
316 extensions::EventRouterForwarder* extension_event_router_forwarder) 316 extensions::EventRouterForwarder* extension_event_router_forwarder)
317 : net_log_(net_log), 317 : net_log_(net_log),
318 #if defined(ENABLE_EXTENSIONS) 318 #if defined(ENABLE_EXTENSIONS)
319 extension_event_router_forwarder_(extension_event_router_forwarder), 319 extension_event_router_forwarder_(extension_event_router_forwarder),
320 #endif 320 #endif
321 globals_(nullptr), 321 globals_(NULL),
322 is_quic_allowed_by_policy_(true), 322 is_quic_allowed_by_policy_(true),
323 http_09_on_non_default_ports_enabled_(false),
324 creation_time_(base::TimeTicks::Now()), 323 creation_time_(base::TimeTicks::Now()),
325 weak_factory_(this) { 324 weak_factory_(this) {
326 scoped_refptr<base::SingleThreadTaskRunner> io_thread_proxy = 325 scoped_refptr<base::SingleThreadTaskRunner> io_thread_proxy =
327 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO); 326 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO);
328 auth_schemes_ = local_state->GetString(prefs::kAuthSchemes); 327 auth_schemes_ = local_state->GetString(prefs::kAuthSchemes);
329 negotiate_disable_cname_lookup_.Init( 328 negotiate_disable_cname_lookup_.Init(
330 prefs::kDisableAuthNegotiateCnameLookup, local_state, 329 prefs::kDisableAuthNegotiateCnameLookup, local_state,
331 base::Bind(&IOThread::UpdateNegotiateDisableCnameLookup, 330 base::Bind(&IOThread::UpdateNegotiateDisableCnameLookup,
332 base::Unretained(this))); 331 base::Unretained(this)));
333 negotiate_disable_cname_lookup_.MoveToThread(io_thread_proxy); 332 negotiate_disable_cname_lookup_.MoveToThread(io_thread_proxy);
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 pac_https_url_stripping_enabled_.Init(prefs::kPacHttpsUrlStrippingEnabled, 387 pac_https_url_stripping_enabled_.Init(prefs::kPacHttpsUrlStrippingEnabled,
389 local_state); 388 local_state);
390 pac_https_url_stripping_enabled_.MoveToThread(io_thread_proxy); 389 pac_https_url_stripping_enabled_.MoveToThread(io_thread_proxy);
391 390
392 const base::Value* value = policy_service->GetPolicies( 391 const base::Value* value = policy_service->GetPolicies(
393 policy::PolicyNamespace(policy::POLICY_DOMAIN_CHROME, 392 policy::PolicyNamespace(policy::POLICY_DOMAIN_CHROME,
394 std::string())).GetValue(policy::key::kQuicAllowed); 393 std::string())).GetValue(policy::key::kQuicAllowed);
395 if (value) 394 if (value)
396 value->GetAsBoolean(&is_quic_allowed_by_policy_); 395 value->GetAsBoolean(&is_quic_allowed_by_policy_);
397 396
398 value = policy_service
399 ->GetPolicies(policy::PolicyNamespace(
400 policy::POLICY_DOMAIN_CHROME, std::string()))
401 .GetValue(policy::key::kHttp09OnNonDefaultPortsEnabled);
402 if (value)
403 value->GetAsBoolean(&http_09_on_non_default_ports_enabled_);
404
405 // Some unit tests use IOThread but do not initialize MetricsService. In that 397 // Some unit tests use IOThread but do not initialize MetricsService. In that
406 // case it is fine not to have |metrics_data_use_forwarder_|. 398 // case it is fine not to have |metrics_data_use_forwarder_|.
407 if (g_browser_process->metrics_service()) { 399 if (g_browser_process->metrics_service()) {
408 // Callback for updating data use prefs should be obtained on UI thread. 400 // Callback for updating data use prefs should be obtained on UI thread.
409 metrics_data_use_forwarder_ = 401 metrics_data_use_forwarder_ =
410 g_browser_process->metrics_service()->GetDataUseForwardingCallback(); 402 g_browser_process->metrics_service()->GetDataUseForwardingCallback();
411 } 403 }
412 404
413 chrome_browser_net::SetGlobalSTHDistributor( 405 chrome_browser_net::SetGlobalSTHDistributor(
414 std::unique_ptr<net::ct::STHDistributor>(new net::ct::STHDistributor())); 406 std::unique_ptr<net::ct::STHDistributor>(new net::ct::STHDistributor()));
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
608 // Check for OS support of TCP FastOpen, and turn it on for all connections if 600 // Check for OS support of TCP FastOpen, and turn it on for all connections if
609 // indicated by user. 601 // indicated by user.
610 // TODO(rch): Make the client socket factory a per-network session instance, 602 // TODO(rch): Make the client socket factory a per-network session instance,
611 // constructed from a NetworkSession::Params, to allow us to move this option 603 // constructed from a NetworkSession::Params, to allow us to move this option
612 // to IOThread::Globals & HttpNetworkSession::Params. 604 // to IOThread::Globals & HttpNetworkSession::Params.
613 bool always_enable_tfo_if_supported = 605 bool always_enable_tfo_if_supported =
614 command_line.HasSwitch(switches::kEnableTcpFastOpen); 606 command_line.HasSwitch(switches::kEnableTcpFastOpen);
615 net::CheckSupportAndMaybeEnableTCPFastOpen(always_enable_tfo_if_supported); 607 net::CheckSupportAndMaybeEnableTCPFastOpen(always_enable_tfo_if_supported);
616 608
617 ConfigureParamsFromFieldTrialsAndCommandLine( 609 ConfigureParamsFromFieldTrialsAndCommandLine(
618 command_line, is_quic_allowed_by_policy_, 610 command_line, is_quic_allowed_by_policy_, &params_);
619 http_09_on_non_default_ports_enabled_, &params_);
620 611
621 TRACE_EVENT_BEGIN0("startup", 612 TRACE_EVENT_BEGIN0("startup",
622 "IOThread::Init:ProxyScriptFetcherRequestContext"); 613 "IOThread::Init:ProxyScriptFetcherRequestContext");
623 globals_->proxy_script_fetcher_context.reset( 614 globals_->proxy_script_fetcher_context.reset(
624 ConstructProxyScriptFetcherContext(globals_, params_, net_log_)); 615 ConstructProxyScriptFetcherContext(globals_, params_, net_log_));
625 TRACE_EVENT_END0("startup", 616 TRACE_EVENT_END0("startup",
626 "IOThread::Init:ProxyScriptFetcherRequestContext"); 617 "IOThread::Init:ProxyScriptFetcherRequestContext");
627 618
628 #if defined(OS_MACOSX) 619 #if defined(OS_MACOSX)
629 // Start observing Keychain events. This needs to be done on the UI thread, 620 // Start observing Keychain events. This needs to be done on the UI thread,
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
888 context->set_http_transaction_factory( 879 context->set_http_transaction_factory(
889 globals->system_http_transaction_factory.get()); 880 globals->system_http_transaction_factory.get());
890 881
891 return context; 882 return context;
892 } 883 }
893 884
894 // static 885 // static
895 void IOThread::ConfigureParamsFromFieldTrialsAndCommandLine( 886 void IOThread::ConfigureParamsFromFieldTrialsAndCommandLine(
896 const base::CommandLine& command_line, 887 const base::CommandLine& command_line,
897 bool is_quic_allowed_by_policy, 888 bool is_quic_allowed_by_policy,
898 bool http_09_on_non_default_ports_enabled,
899 net::HttpNetworkSession::Params* params) { 889 net::HttpNetworkSession::Params* params) {
900 std::string quic_user_agent_id = chrome::GetChannelString(); 890 std::string quic_user_agent_id = chrome::GetChannelString();
901 if (!quic_user_agent_id.empty()) 891 if (!quic_user_agent_id.empty())
902 quic_user_agent_id.push_back(' '); 892 quic_user_agent_id.push_back(' ');
903 quic_user_agent_id.append( 893 quic_user_agent_id.append(
904 version_info::GetProductNameAndVersionForUserAgent()); 894 version_info::GetProductNameAndVersionForUserAgent());
905 quic_user_agent_id.push_back(' '); 895 quic_user_agent_id.push_back(' ');
906 quic_user_agent_id.append(content::BuildOSCpuInfo()); 896 quic_user_agent_id.append(content::BuildOSCpuInfo());
907 897
908 bool is_quic_force_disabled = !is_quic_allowed_by_policy || 898 bool is_quic_force_disabled = !is_quic_allowed_by_policy ||
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
985 if (command_line.HasSwitch(switches::kIgnoreCertificateErrors)) 975 if (command_line.HasSwitch(switches::kIgnoreCertificateErrors))
986 params->ignore_certificate_errors = true; 976 params->ignore_certificate_errors = true;
987 if (command_line.HasSwitch(switches::kTestingFixedHttpPort)) { 977 if (command_line.HasSwitch(switches::kTestingFixedHttpPort)) {
988 params->testing_fixed_http_port = 978 params->testing_fixed_http_port =
989 GetSwitchValueAsInt(command_line, switches::kTestingFixedHttpPort); 979 GetSwitchValueAsInt(command_line, switches::kTestingFixedHttpPort);
990 } 980 }
991 if (command_line.HasSwitch(switches::kTestingFixedHttpsPort)) { 981 if (command_line.HasSwitch(switches::kTestingFixedHttpsPort)) {
992 params->testing_fixed_https_port = 982 params->testing_fixed_https_port =
993 GetSwitchValueAsInt(command_line, switches::kTestingFixedHttpsPort); 983 GetSwitchValueAsInt(command_line, switches::kTestingFixedHttpsPort);
994 } 984 }
995
996 params->http_09_on_non_default_ports_enabled =
997 http_09_on_non_default_ports_enabled;
998 } 985 }
999 986
1000 // static 987 // static
1001 net::URLRequestContext* IOThread::ConstructProxyScriptFetcherContext( 988 net::URLRequestContext* IOThread::ConstructProxyScriptFetcherContext(
1002 IOThread::Globals* globals, 989 IOThread::Globals* globals,
1003 const net::HttpNetworkSession::Params& params, 990 const net::HttpNetworkSession::Params& params,
1004 net::NetLog* net_log) { 991 net::NetLog* net_log) {
1005 net::URLRequestContext* context = new net::URLRequestContext; 992 net::URLRequestContext* context = new net::URLRequestContext;
1006 context->set_net_log(net_log); 993 context->set_net_log(net_log);
1007 context->set_host_resolver(globals->host_resolver.get()); 994 context->set_host_resolver(globals->host_resolver.get());
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
1069 // TODO(rtenneti): We should probably use HttpServerPropertiesManager for the 1056 // TODO(rtenneti): We should probably use HttpServerPropertiesManager for the
1070 // system URLRequestContext too. There's no reason this should be tied to a 1057 // system URLRequestContext too. There's no reason this should be tied to a
1071 // profile. 1058 // profile.
1072 return context; 1059 return context;
1073 } 1060 }
1074 1061
1075 const metrics::UpdateUsagePrefCallbackType& 1062 const metrics::UpdateUsagePrefCallbackType&
1076 IOThread::GetMetricsDataUseForwarder() { 1063 IOThread::GetMetricsDataUseForwarder() {
1077 return metrics_data_use_forwarder_; 1064 return metrics_data_use_forwarder_;
1078 } 1065 }
OLDNEW
« no previous file with comments | « chrome/browser/io_thread.h ('k') | chrome/browser/io_thread_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698