From 07c4661b43911715bafcbdf9f0100d2824435d7e Mon Sep 17 00:00:00 2001 From: David Schinazi Date: Thu, 18 Feb 2021 02:32:10 +0000 Subject: [PATCH] Default-enable IETF QUIC h3-29 This CL changes the default list of supported versions to both Q050 and h3-29. This means that users of Chrome that do not use Finch will now have support for h3-29, and also that cronet users also get support for it. Note that this is disabled for cronet users that use connection migration, as we are not yet spec-compliant there. This CL also default-disabled 0-RTT for QUIC+TLS because we haven't yet launched it via Finch. R=renjietang@chromium.org Change-Id: Ic547396c55e26136468c73d3c35b60ec2066f196 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2702157 Commit-Queue: David Schinazi Auto-Submit: David Schinazi Reviewed-by: Renjie Tang Cr-Commit-Position: refs/heads/master@{#855084} --- .../cronet/url_request_context_config.cc | 21 +++++++++++++++++++ .../url_request_context_config_unittest.cc | 2 ++ ...http_server_properties_manager_unittest.cc | 4 ++-- net/quic/quic_context.h | 12 +++++++++-- 4 files changed, 35 insertions(+), 4 deletions(-) diff --git a/components/cronet/url_request_context_config.cc b/components/cronet/url_request_context_config.cc index ce5adc73520be..52d31591e30dc 100644 --- a/components/cronet/url_request_context_config.cc +++ b/components/cronet/url_request_context_config.cc @@ -553,6 +553,27 @@ void URLRequestContextConfig::ParseAndSetExperimentalOptions( quic_params->ios_network_service_type = quic_ios_network_service_type; } + // Do not enable IETF QUIC when connection migration is enabled because + // our current connection migration code does not yet fully support the + // version of connection migration in the IETF spec. + // TODO(dschinazi) remove this once we support the spec. + if ((quic_migrate_sessions_on_network_change_v2 || + quic_migrate_idle_sessions || quic_migrate_sessions_early_v2) && + quic_version_string.empty()) { + quic::ParsedQuicVersionVector migration_versions; + for (const quic::ParsedQuicVersion& version : + quic_params->supported_versions) { + if (!version.UsesHttp3()) { + migration_versions.push_back(version); + } + } + quic_params->supported_versions = migration_versions; + if (quic_params->supported_versions.empty()) { + quic_params->supported_versions = + quic::ParsedQuicVersionVector{quic::ParsedQuicVersion::Q050()}; + } + } + } else if (it.key() == kAsyncDnsFieldTrialName) { const base::DictionaryValue* async_dns_args = nullptr; if (!it.value().GetAsDictionary(&async_dns_args)) { diff --git a/components/cronet/url_request_context_config_unittest.cc b/components/cronet/url_request_context_config_unittest.cc index 7dc243230a387..1e45e6f7ba8cf 100644 --- a/components/cronet/url_request_context_config_unittest.cc +++ b/components/cronet/url_request_context_config_unittest.cc @@ -862,6 +862,8 @@ TEST(URLRequestContextConfigTest, SetQuicConnectionMigrationV2Options) { quic_params->max_migrations_to_non_default_network_on_write_error); EXPECT_EQ( 4, quic_params->max_migrations_to_non_default_network_on_path_degrading); + EXPECT_EQ(quic::ParsedQuicVersionVector{quic::ParsedQuicVersion::Q050()}, + quic_params->supported_versions); } TEST(URLRequestContextConfigTest, SetQuicStaleDNSracing) { diff --git a/net/http/http_server_properties_manager_unittest.cc b/net/http/http_server_properties_manager_unittest.cc index 9a490694a9e15..0cb965636f458 100644 --- a/net/http/http_server_properties_manager_unittest.cc +++ b/net/http/http_server_properties_manager_unittest.cc @@ -1527,7 +1527,7 @@ TEST_F(HttpServerPropertiesManagerTest, PersistAdvertisedVersionsToPref) { "\"isolation\":[]," "\"server\":\"https://www.google.com:80\"}," "{\"alternative_service\":[{" - "\"advertised_versions\":[50],\"expiration\":\"9223372036854775807\"," + "\"advertised_versions\":[50,73],\"expiration\":\"9223372036854775807\"," "\"host\":\"foo.google.com\",\"port\":444,\"protocol_str\":\"quic\"}]," "\"isolation\":[]," "\"network_stats\":{\"srtt\":42}," @@ -1638,7 +1638,7 @@ TEST_F(HttpServerPropertiesManagerTest, "\"server_id\":\"https://mail.google.com:80\"," "\"server_info\":\"quic_server_info1\"}]," "\"servers\":[" - "{\"alternative_service\":[{\"advertised_versions\":[50]," + "{\"alternative_service\":[{\"advertised_versions\":[50,73]," "\"expiration\":\"13756212000000000\",\"port\":443," "\"protocol_str\":\"quic\"}]," "\"isolation\":[]," diff --git a/net/quic/quic_context.h b/net/quic/quic_context.h index b622eaddfda06..bdd43724336ac 100644 --- a/net/quic/quic_context.h +++ b/net/quic/quic_context.h @@ -16,7 +16,15 @@ namespace net { // configuration. inline NET_EXPORT_PRIVATE quic::ParsedQuicVersionVector DefaultSupportedQuicVersions() { - return quic::ParsedQuicVersionVector{quic::ParsedQuicVersion::Q050()}; + // The ordering of this list does not matter for Chrome because it respects + // the ordering received from the server via Alt-Svc. However, cronet offers + // an addQuicHint() API which uses the first version from this list until + // it receives Alt-Svc from the server. We therefore list Q050 first here + // because there are some cronet applications which communicate with servers + // that speak Q050 but not Draft29. + // TODO(dschinazi) Move Draft29 first once those servers support it. + return quic::ParsedQuicVersionVector{quic::ParsedQuicVersion::Q050(), + quic::ParsedQuicVersion::Draft29()}; } // Obsolete QUIC supported versions are versions that are supported by the @@ -171,7 +179,7 @@ struct NET_EXPORT QuicParams { // smoothed rtt is present. base::TimeDelta initial_rtt_for_handshake; // If true, QUIC with TLS will not try 0-RTT connection. - bool disable_tls_zero_rtt = false; + bool disable_tls_zero_rtt = true; // If true, gQUIC requests will always require confirmation. bool disable_gquic_zero_rtt = false; // Network Service Type of the socket for iOS. Default is NET_SERVICE_TYPE_BE