tor-browser

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

commit 6e47dbc7c4fc6cd0fa7ac9c200212c56b781c370
parent 7ca713a4348567973e9a56f0d5c9293237e7f147
Author: Kershaw Chang <kershaw@mozilla.com>
Date:   Thu,  2 Oct 2025 09:06:13 +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:
Mnetwerk/protocol/http/nsHttpTransaction.cpp | 22++++++++++++++--------
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); }