tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit ba6fe1dd163d272656332a3d825c716a3ad9dedc
parent 00a66cf54e414c68fd709d5d18be2cf4c07ab87c
Author: Kershaw Chang <kershaw@mozilla.com>
Date:   Tue, 14 Oct 2025 08:25:00 +0000

Bug 1993438 - Make Alt-Svc work for connect-udp, r=necko-reviewers,valentin

Depends on D268120

Differential Revision: https://phabricator.services.mozilla.com/D268121

Diffstat:
Mnetwerk/protocol/http/AlternateServices.cpp | 4++--
Mnetwerk/protocol/http/Http3ConnectUDPStream.cpp | 12+++++++++---
2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/netwerk/protocol/http/AlternateServices.cpp b/netwerk/protocol/http/AlternateServices.cpp @@ -1130,8 +1130,8 @@ void AltSvcCache::UpdateAltServiceMapping( } if (map->IsHttp3()) { - bool isDirectOrNoProxy = pi ? pi->IsDirect() : true; - if (!isDirectOrNoProxy) { + bool isProxyAllowed = pi ? (pi->IsDirect() || pi->IsHttp3Proxy()) : true; + if (!isProxyAllowed) { LOG( ("AltSvcCache::UpdateAltServiceMapping %p map %p ignored h3 because " "proxy is in use %p\n", diff --git a/netwerk/protocol/http/Http3ConnectUDPStream.cpp b/netwerk/protocol/http/Http3ConnectUDPStream.cpp @@ -101,13 +101,19 @@ nsresult Http3ConnectUDPStream::TryActivating() { return NS_ERROR_UNEXPECTED; } - nsresult rv = builder->Set("target_host"_ns, - mTransaction->ConnectionInfo()->GetOrigin()); + bool useRoutedHost = + !mTransaction->ConnectionInfo()->GetRoutedHost().IsEmpty(); + nsresult rv = builder->Set( + "target_host"_ns, useRoutedHost + ? mTransaction->ConnectionInfo()->GetRoutedHost() + : mTransaction->ConnectionInfo()->GetOrigin()); if (NS_FAILED(rv)) { return rv; } rv = builder->Set("target_port"_ns, - mTransaction->ConnectionInfo()->OriginPort()); + useRoutedHost + ? mTransaction->ConnectionInfo()->RoutedPort() + : mTransaction->ConnectionInfo()->OriginPort()); if (NS_FAILED(rv)) { return rv; }