commit fb2b1473c009464d91fe6c3d98ecf0bba2649b0f
parent 49a4fde0b0645eed550c6ccc417143f1fa774237
Author: Valentin Gosu <valentin.gosu@gmail.com>
Date: Mon, 17 Nov 2025 08:35: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:
2 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/modules/libpref/init/StaticPrefList.yaml b/modules/libpref/init/StaticPrefList.yaml
@@ -15257,6 +15257,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