From b3af1b0d37cd3feb88766dcfb272ff5af8505c4a Mon Sep 17 00:00:00 2001 From: Carmelo Messina Date: Tue, 1 Aug 2023 18:11:14 +0200 Subject: [PATCH] Disable remote altsvc for h3 connections --- build/bromite_patches_list.txt | 3 +- ...ble-remote-altsvc-for-h3-connections.patch | 63 +++++++++++++++++++ 2 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 build/patches/00Disable-remote-altsvc-for-h3-connections.patch diff --git a/build/bromite_patches_list.txt b/build/bromite_patches_list.txt index 26097052..b9f4eef7 100644 --- a/build/bromite_patches_list.txt +++ b/build/bromite_patches_list.txt @@ -282,4 +282,5 @@ Timezone-customization.patch 00Show-warnings-on-downloads-over-HTTP.patch 00Compress-libchrome-to-free-up-some-space.patch 00Cromite-Branding.patch -00Disable-Feeback-Collector.patch \ No newline at end of file +00Disable-Feeback-Collector.patch +00Disable-remote-altsvc-for-h3-connections.patch \ No newline at end of file diff --git a/build/patches/00Disable-remote-altsvc-for-h3-connections.patch b/build/patches/00Disable-remote-altsvc-for-h3-connections.patch new file mode 100644 index 00000000..1354d6c5 --- /dev/null +++ b/build/patches/00Disable-remote-altsvc-for-h3-connections.patch @@ -0,0 +1,63 @@ +From: uazo +Date: Tue, 1 Aug 2023 13:56:42 +0000 +Subject: Disable remote altsvc for h3 connections + +and only sets the use of port 443 +--- + net/http/http_server_properties_manager.cc | 2 +- + net/http/http_stream_factory_job_controller.cc | 9 ++------- + net/quic/quic_context.h | 2 +- + 3 files changed, 4 insertions(+), 9 deletions(-) + +diff --git a/net/http/http_server_properties_manager.cc b/net/http/http_server_properties_manager.cc +--- a/net/http/http_server_properties_manager.cc ++++ b/net/http/http_server_properties_manager.cc +@@ -38,7 +38,7 @@ const int kMissingVersion = 0; + const int kVersionNumber = 5; + + // Persist at most 200 currently-broken alternative services to disk. +-const int kMaxBrokenAlternativeServicesToPersist = 200; ++const int kMaxBrokenAlternativeServicesToPersist = 0; + + const char kServerKey[] = "server"; + const char kQuicServerIdKey[] = "server_id"; +diff --git a/net/http/http_stream_factory_job_controller.cc b/net/http/http_stream_factory_job_controller.cc +--- a/net/http/http_stream_factory_job_controller.cc ++++ b/net/http/http_stream_factory_job_controller.cc +@@ -1236,11 +1236,7 @@ HttpStreamFactory::JobController::GetAlternativeServiceInfoInternal( + // single user on a multi-user system to hijack the alternate protocol. + // These systems also enforce ports <1024 as restricted ports. So don't + // allow protocol upgrades to user-controllable ports. +- const int kUnrestrictedPort = 1024; +- if (!session_->params().enable_user_alternate_protocol_ports && +- (alternative_service_info.alternative_service().port >= +- kUnrestrictedPort && +- original_url.EffectiveIntPort() < kUnrestrictedPort)) ++ if (alternative_service_info.alternative_service().port != 443) + continue; + + if (alternative_service_info.protocol() == kProtoHTTP2) { +@@ -1277,8 +1273,7 @@ HttpStreamFactory::JobController::GetAlternativeServiceInfoInternal( + + GURL destination = CreateAltSvcUrl( + original_url, alternative_service_info.host_port_pair()); +- if (session_key.host() != destination.host_piece() && +- !session_->context().quic_context->params()->allow_remote_alt_svc) { ++ if (session_key.host() != destination.host_piece()) { + continue; + } + RewriteUrlWithHostMappingRules(destination); +diff --git a/net/quic/quic_context.h b/net/quic/quic_context.h +--- a/net/quic/quic_context.h ++++ b/net/quic/quic_context.h +@@ -176,7 +176,7 @@ struct NET_EXPORT QuicParams { + bool allow_server_migration = false; + // If true, allows QUIC to use alternative services with a different + // hostname from the origin. +- bool allow_remote_alt_svc = true; ++ bool allow_remote_alt_svc = false; // Disabled by default + // If true, estimate the initial RTT for QUIC connections based on network. + bool estimate_initial_rtt = false; + // The initial rtt that will be used in crypto handshake if no cached +-- +2.25.1