diff --git a/modules/libpref/init/StaticPrefList.yaml b/modules/libpref/init/StaticPrefList.yaml index e1fd0b08481d..5448c0beedcd 100644 --- a/modules/libpref/init/StaticPrefList.yaml +++ b/modules/libpref/init/StaticPrefList.yaml @@ -12526,12 +12526,6 @@ value: false mirror: always -# When a Http/3 connection failed, whether to retry with a different IP address. -- name: network.http.http3.retry_different_ip_family - type: RelaxedAtomicBool - value: true - mirror: always - # When true, a http request will be upgraded to https when HTTPS RR is # available. - name: network.dns.upgrade_with_https_rr diff --git a/netwerk/protocol/http/ConnectionEntry.cpp b/netwerk/protocol/http/ConnectionEntry.cpp index a18ba1dca7f4..b6d4dd5b4f96 100644 --- a/netwerk/protocol/http/ConnectionEntry.cpp +++ b/netwerk/protocol/http/ConnectionEntry.cpp @@ -1004,53 +1004,5 @@ nsresult ConnectionEntry::CreateDnsAndConnectSocket( return NS_OK; } -bool ConnectionEntry::AllowToRetryDifferentIPFamilyForHttp3(nsresult aError) { - LOG( - ("ConnectionEntry::AllowToRetryDifferentIPFamilyForHttp3 %p " - "error=%" PRIx32, - this, static_cast(aError))); - if (!IsHttp3()) { - MOZ_ASSERT(false, "Should not be called for non Http/3 connection"); - return false; - } - - if (!StaticPrefs::network_http_http3_retry_different_ip_family()) { - return false; - } - - // Only allow to retry with these two errors. - if (aError != NS_ERROR_CONNECTION_REFUSED && - aError != NS_ERROR_PROXY_CONNECTION_REFUSED) { - return false; - } - - // Already retried once. - if (mRetriedDifferentIPFamilyForHttp3) { - return false; - } - - return true; -} - -void ConnectionEntry::SetRetryDifferentIPFamilyForHttp3(uint16_t aIPFamily) { - LOG(("ConnectionEntry::SetRetryDifferentIPFamilyForHttp3 %p, af=%u", this, - aIPFamily)); - - mPreferIPv4 = false; - mPreferIPv6 = false; - - if (aIPFamily == AF_INET) { - mPreferIPv6 = true; - } - - if (aIPFamily == AF_INET6) { - mPreferIPv4 = true; - } - - LOG((" %p prefer ipv4=%d, ipv6=%d", this, (bool)mPreferIPv4, - (bool)mPreferIPv6)); - MOZ_DIAGNOSTIC_ASSERT(mPreferIPv4 ^ mPreferIPv6); -} - } // namespace net } // namespace mozilla diff --git a/netwerk/protocol/http/ConnectionEntry.h b/netwerk/protocol/http/ConnectionEntry.h index 693289d8b3d7..7d7584274ef4 100644 --- a/netwerk/protocol/http/ConnectionEntry.h +++ b/netwerk/protocol/http/ConnectionEntry.h @@ -195,9 +195,6 @@ class ConnectionEntry { void MaybeUpdateEchConfig(nsHttpConnectionInfo* aConnInfo); - bool AllowToRetryDifferentIPFamilyForHttp3(nsresult aError); - void SetRetryDifferentIPFamilyForHttp3(uint16_t aIPFamily); - private: void InsertIntoIdleConnections_internal(nsHttpConnection* conn); void RemoveFromIdleConnectionsIndex(size_t inx); @@ -214,8 +211,6 @@ class ConnectionEntry { PendingTransactionQueue mPendingQ; ~ConnectionEntry(); - - bool mRetriedDifferentIPFamilyForHttp3 = false; }; } // namespace net diff --git a/netwerk/protocol/http/Http3Session.cpp b/netwerk/protocol/http/Http3Session.cpp index d2a5f4ed9b20..87aa0ba55492 100644 --- a/netwerk/protocol/http/Http3Session.cpp +++ b/netwerk/protocol/http/Http3Session.cpp @@ -230,18 +230,11 @@ void Http3Session::Shutdown() { bool isEchRetry = mError == mozilla::psm::GetXPCOMFromNSSError( SSL_ERROR_ECH_RETRY_WITH_ECH); - bool allowToRetryWithDifferentIPFamily = - mBeforeConnectedError && - gHttpHandler->ConnMgr()->AllowToRetryDifferentIPFamilyForHttp3(mConnInfo, - mError); - LOG(("Http3Session::Shutdown %p allowToRetryWithDifferentIPFamily=%d", this, - allowToRetryWithDifferentIPFamily)); if ((mBeforeConnectedError || (mError == NS_ERROR_NET_HTTP3_PROTOCOL_ERROR)) && (mError != mozilla::psm::GetXPCOMFromNSSError(SSL_ERROR_BAD_CERT_DOMAIN)) && - !isEchRetry && !mConnInfo->GetWebTransport() && - !allowToRetryWithDifferentIPFamily && !mDontExclude) { + !isEchRetry && !mConnInfo->GetWebTransport()) { gHttpHandler->ExcludeHttp3(mConnInfo); } @@ -256,28 +249,7 @@ void Http3Session::Shutdown() { // transaction will be restarted with a new echConfig. stream->Close(mError); } else { - if (allowToRetryWithDifferentIPFamily && mNetAddr) { - NetAddr addr; - mNetAddr->GetNetAddr(&addr); - gHttpHandler->ConnMgr()->SetRetryDifferentIPFamilyForHttp3( - mConnInfo, addr.raw.family); - nsHttpTransaction* trans = - stream->Transaction()->QueryHttpTransaction(); - if (trans) { - // This is a bit hacky. We redispatch the transaction here to avoid - // touching the complicated retry logic in nsHttpTransaction. - trans->RemoveConnection(); - Unused << gHttpHandler->InitiateTransaction(trans, - trans->Priority()); - } else { - stream->Close(NS_ERROR_NET_RESET); - } - // Since Http3Session::Shutdown can be called multiple times, we set - // mDontExclude for not putting this domain into the excluded list. - mDontExclude = true; - } else { - stream->Close(NS_ERROR_NET_RESET); - } + stream->Close(NS_ERROR_NET_RESET); } } else if (!stream->HasStreamId()) { if (NS_SUCCEEDED(mError)) { diff --git a/netwerk/protocol/http/Http3Session.h b/netwerk/protocol/http/Http3Session.h index fa15c7df8fd0..2ee60c395ddc 100644 --- a/netwerk/protocol/http/Http3Session.h +++ b/netwerk/protocol/http/Http3Session.h @@ -370,8 +370,6 @@ class Http3Session final : public nsAHttpTransaction, public nsAHttpConnection { nsTArray> mWebTransportStreams; bool mHasWebTransportSession = false; - // When true, we don't add this connection info into the Http/3 excluded list. - bool mDontExclude = false; }; NS_DEFINE_STATIC_IID_ACCESSOR(Http3Session, NS_HTTP3SESSION_IID); diff --git a/netwerk/protocol/http/nsHttpConnectionMgr.cpp b/netwerk/protocol/http/nsHttpConnectionMgr.cpp index 67865e0556d4..6167a2668674 100644 --- a/netwerk/protocol/http/nsHttpConnectionMgr.cpp +++ b/netwerk/protocol/http/nsHttpConnectionMgr.cpp @@ -3818,24 +3818,4 @@ void nsHttpConnectionMgr::CheckTransInPendingQueue(nsHttpTransaction* aTrans) { #endif } -bool nsHttpConnectionMgr::AllowToRetryDifferentIPFamilyForHttp3( - nsHttpConnectionInfo* ci, nsresult aError) { - ConnectionEntry* ent = mCT.GetWeak(ci->HashKey()); - if (!ent) { - return false; - } - - return ent->AllowToRetryDifferentIPFamilyForHttp3(aError); -} - -void nsHttpConnectionMgr::SetRetryDifferentIPFamilyForHttp3( - nsHttpConnectionInfo* ci, uint16_t aIPFamily) { - ConnectionEntry* ent = mCT.GetWeak(ci->HashKey()); - if (!ent) { - return; - } - - ent->SetRetryDifferentIPFamilyForHttp3(aIPFamily); -} - } // namespace mozilla::net diff --git a/netwerk/protocol/http/nsHttpConnectionMgr.h b/netwerk/protocol/http/nsHttpConnectionMgr.h index 2cf4ab7568f3..e78d1b458078 100644 --- a/netwerk/protocol/http/nsHttpConnectionMgr.h +++ b/netwerk/protocol/http/nsHttpConnectionMgr.h @@ -191,11 +191,6 @@ class nsHttpConnectionMgr final : public HttpConnectionMgrShell, // connection bool BeConservativeIfProxied(nsIProxyInfo* proxy); - bool AllowToRetryDifferentIPFamilyForHttp3(nsHttpConnectionInfo* ci, - nsresult aError); - void SetRetryDifferentIPFamilyForHttp3(nsHttpConnectionInfo* ci, - uint16_t aIPFamily); - protected: friend class ConnectionEntry; void IncrementActiveConnCount(); diff --git a/netwerk/protocol/http/nsHttpTransaction.cpp b/netwerk/protocol/http/nsHttpTransaction.cpp index fcfbdb6503a2..63cd3c3c27b3 100644 --- a/netwerk/protocol/http/nsHttpTransaction.cpp +++ b/netwerk/protocol/http/nsHttpTransaction.cpp @@ -3534,9 +3534,4 @@ void nsHttpTransaction::SetIsForWebTransport(bool aIsForWebTransport) { mIsForWebTransport = aIsForWebTransport; } -void nsHttpTransaction::RemoveConnection() { - MutexAutoLock lock(mLock); - mConnection = nullptr; -} - } // namespace mozilla::net diff --git a/netwerk/protocol/http/nsHttpTransaction.h b/netwerk/protocol/http/nsHttpTransaction.h index 364fa7b1e604..0f8a3cce0779 100644 --- a/netwerk/protocol/http/nsHttpTransaction.h +++ b/netwerk/protocol/http/nsHttpTransaction.h @@ -88,7 +88,7 @@ class nsHttpTransaction final : public nsAHttpTransaction, void MakeNonSticky() override { mCaps &= ~NS_HTTP_STICKY_CONNECTION; } void MakeRestartable() override { mCaps |= NS_HTTP_CONNECTION_RESTARTABLE; } void MakeNonRestartable() { mCaps &= ~NS_HTTP_CONNECTION_RESTARTABLE; } - void RemoveConnection(); + void SetIsHttp2Websocket(bool h2ws) override { mIsHttp2Websocket = h2ws; } bool IsHttp2Websocket() override { return mIsHttp2Websocket; }