commit f5d97384bb4cf3c40ff6e6369fe62e2dd060e9e7
parent f7dd2562e8723829196d989a947b461f88395cff
Author: Kershaw Chang <kershaw@mozilla.com>
Date: Thu, 2 Oct 2025 13:59:39 +0000
Bug 1991426 - Ensure we fallback the outer connection when mBeforeConnectedError is true, r=necko-reviewers,valentin
Differential Revision: https://phabricator.services.mozilla.com/D266669
Diffstat:
1 file changed, 14 insertions(+), 8 deletions(-)
diff --git a/netwerk/protocol/http/nsHttpTransaction.cpp b/netwerk/protocol/http/nsHttpTransaction.cpp
@@ -1881,13 +1881,18 @@ nsresult nsHttpTransaction::Restart() {
// to the next
mReuseOnRestart = false;
- if (!mDoNotRemoveAltSvc &&
- (!mConnInfo->GetRoutedHost().IsEmpty() || mConnInfo->IsHttp3()) &&
- !mDontRetryWithDirectRoute) {
- RefPtr<nsHttpConnectionInfo> ci;
- mConnInfo->CloneAsDirectRoute(getter_AddRefs(ci));
- mConnInfo = ci;
- RemoveAlternateServiceUsedHeader(mRequestHead);
+ if (!mDoNotRemoveAltSvc && !mDontRetryWithDirectRoute) {
+ if (mConnInfo->IsHttp3ProxyConnection()) {
+ RefPtr<nsHttpConnectionInfo> ci =
+ mConnInfo->CreateConnectUDPFallbackConnInfo();
+ mConnInfo = ci;
+ RemoveAlternateServiceUsedHeader(mRequestHead);
+ } else if (!mConnInfo->GetRoutedHost().IsEmpty() || mConnInfo->IsHttp3()) {
+ RefPtr<nsHttpConnectionInfo> ci;
+ mConnInfo->CloneAsDirectRoute(getter_AddRefs(ci));
+ mConnInfo = ci;
+ RemoveAlternateServiceUsedHeader(mRequestHead);
+ }
}
// Reset mDoNotRemoveAltSvc for the next try.
@@ -3534,7 +3539,8 @@ void nsHttpTransaction::OnHttp3TunnelFallbackTimer() {
}
DisableHttp3(false);
-
+ // Setting this flag since DisableHttp3 is already called.
+ mDontRetryWithDirectRoute = true;
if (mConnection) {
mConnection->CloseTransaction(this, NS_ERROR_NET_RESET);
}