tor-browser

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

commit 209546251a628937764e84bdef7da588298ff8f2
parent bc019c8286148bb97827a47694b893cffcc74dc1
Author: Valentin Gosu <valentin.gosu@gmail.com>
Date:   Fri, 14 Nov 2025 11:08:45 +0000

Bug 2000189 - Make Http3Session::TryActivating return error code instead of NS_OK r=kershaw,necko-reviewers

Returning NS_OK here made the transaction appear to have been processed
but instead it is just pending until the H3 connection is closed
after which it was eventually retried with H2.

TODO:
Is it correct to return NS_ERROR_HTTP2_FALLBACK_TO_HTTP1 for webtransport
or connect-udp streams?
Which errors should fallback to H2 and which should be returned immediately?

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

Diffstat:
Mmodules/libpref/init/StaticPrefList.yaml | 7+++++++
Mnetwerk/protocol/http/Http3Session.cpp | 10++++++++--
2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/modules/libpref/init/StaticPrefList.yaml b/modules/libpref/init/StaticPrefList.yaml @@ -15255,6 +15255,13 @@ mirror: always rust: true +# Fallback to H2 if mHttp3Connection->Fetch returns an error in +# Http3Session::TryActivating +- name: network.http.http3.fallback_to_h2_on_error + type: RelaxedAtomicBool + value: true + mirror: always + # Maximum number of UDP segments in a single UDP GSO send. Noop if # network.http.http3.use_nspr_for_io is true. - name: network.http.http3.max_gso_segments diff --git a/netwerk/protocol/http/Http3Session.cpp b/netwerk/protocol/http/Http3Session.cpp @@ -1510,8 +1510,14 @@ nsresult Http3Session::TryActivating( return NS_ERROR_HTTP2_FALLBACK_TO_HTTP1; } - // Ignore this error. This may happen if some events are not handled yet. - return NS_OK; + // Previously we always returned NS_OK here, which caused the + // transaction to wait until the quic connection timed out + // after which it was retried without quic. + if (StaticPrefs::network_http_http3_fallback_to_h2_on_error()) { + return NS_ERROR_HTTP2_FALLBACK_TO_HTTP1; + } + + return rv; } LOG(("Http3Session::TryActivating streamId=0x%" PRIx64