mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 21:31:04 +00:00
Bug 1690008 - Clear npnToken when we want to create a non-http3 connection info r=necko-reviewers,dragana
Differential Revision: https://phabricator.services.mozilla.com/D103690
This commit is contained in:
parent
6d623c28f8
commit
a04bced733
@ -63,7 +63,8 @@ nsHttpConnectionInfo::nsHttpConnectionInfo(
|
||||
mEndToEndSSL = true; // so DefaultPort() works
|
||||
mRoutedPort = routedPort == -1 ? DefaultPort() : routedPort;
|
||||
|
||||
if (!originHost.Equals(routedHost) || (originPort != routedPort)) {
|
||||
if (!originHost.Equals(routedHost) || (originPort != routedPort) ||
|
||||
aIsHttp3) {
|
||||
mRoutedHost = routedHost;
|
||||
}
|
||||
Init(originHost, originPort, npnToken, username, proxyInfo, originAttributes,
|
||||
@ -440,17 +441,11 @@ nsHttpConnectionInfo::DeserializeHttpConnectionInfoCloneArgs(
|
||||
}
|
||||
|
||||
void nsHttpConnectionInfo::CloneAsDirectRoute(nsHttpConnectionInfo** outCI) {
|
||||
if (mRoutedHost.IsEmpty()) {
|
||||
RefPtr<nsHttpConnectionInfo> clone = Clone();
|
||||
// Explicitly set mIsHttp3 to false, since CloneAsDirectRoute() is used to
|
||||
// Explicitly use an empty npnToken when |mIsHttp3| is true, since we want to
|
||||
// create a non-http3 connection info.
|
||||
clone->mIsHttp3 = false;
|
||||
clone.forget(outCI);
|
||||
return;
|
||||
}
|
||||
|
||||
RefPtr<nsHttpConnectionInfo> clone =
|
||||
new nsHttpConnectionInfo(mOrigin, mOriginPort, ""_ns, mUsername,
|
||||
RefPtr<nsHttpConnectionInfo> clone = new nsHttpConnectionInfo(
|
||||
mOrigin, mOriginPort,
|
||||
(mRoutedHost.IsEmpty() && !mIsHttp3) ? mNPNToken : ""_ns, mUsername,
|
||||
mProxyInfo, mOriginAttributes, mEndToEndSSL);
|
||||
// Make sure the anonymous, insecure-scheme, and private flags are transferred
|
||||
clone->SetAnonymous(GetAnonymous());
|
||||
|
@ -1744,6 +1744,15 @@ bool nsHttpTransaction::ResponseTimeoutEnabled() const {
|
||||
// nsHttpTransaction <private>
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
static inline void RemoveAlternateServiceUsedHeader(
|
||||
nsHttpRequestHead* aRequestHead) {
|
||||
if (aRequestHead) {
|
||||
DebugOnly<nsresult> rv =
|
||||
aRequestHead->SetHeader(nsHttp::Alternate_Service_Used, "0"_ns);
|
||||
MOZ_ASSERT(NS_SUCCEEDED(rv));
|
||||
}
|
||||
}
|
||||
|
||||
nsresult nsHttpTransaction::Restart() {
|
||||
MOZ_ASSERT(OnSocketThread(), "not on socket thread");
|
||||
|
||||
@ -1794,11 +1803,7 @@ nsresult nsHttpTransaction::Restart() {
|
||||
RefPtr<nsHttpConnectionInfo> ci;
|
||||
mConnInfo->CloneAsDirectRoute(getter_AddRefs(ci));
|
||||
mConnInfo = ci;
|
||||
if (mRequestHead) {
|
||||
DebugOnly<nsresult> rv =
|
||||
mRequestHead->SetHeader(nsHttp::Alternate_Service_Used, "0"_ns);
|
||||
MOZ_ASSERT(NS_SUCCEEDED(rv));
|
||||
}
|
||||
RemoveAlternateServiceUsedHeader(mRequestHead);
|
||||
}
|
||||
|
||||
// Reset mDoNotRemoveAltSvc for the next try.
|
||||
@ -2536,11 +2541,7 @@ void nsHttpTransaction::DisableHttp3() {
|
||||
// After CloneAsDirectRoute(), http3 will be disabled.
|
||||
RefPtr<nsHttpConnectionInfo> connInfo;
|
||||
mConnInfo->CloneAsDirectRoute(getter_AddRefs(connInfo));
|
||||
if (mRequestHead) {
|
||||
DebugOnly<nsresult> rv =
|
||||
mRequestHead->SetHeader(nsHttp::Alternate_Service_Used, "0"_ns);
|
||||
MOZ_ASSERT(NS_SUCCEEDED(rv));
|
||||
}
|
||||
RemoveAlternateServiceUsedHeader(mRequestHead);
|
||||
MOZ_ASSERT(!connInfo->IsHttp3());
|
||||
mConnInfo.swap(connInfo);
|
||||
}
|
||||
@ -2936,11 +2937,7 @@ nsresult nsHttpTransaction::RestartOnFastOpenError() {
|
||||
RefPtr<nsHttpConnectionInfo> ci;
|
||||
mConnInfo->CloneAsDirectRoute(getter_AddRefs(ci));
|
||||
mConnInfo = ci;
|
||||
if (mRequestHead) {
|
||||
DebugOnly<nsresult> rv =
|
||||
mRequestHead->SetHeader(nsHttp::Alternate_Service_Used, "0"_ns);
|
||||
MOZ_ASSERT(NS_SUCCEEDED(rv));
|
||||
}
|
||||
RemoveAlternateServiceUsedHeader(mRequestHead);
|
||||
}
|
||||
mEarlyDataDisposition = EARLY_NONE;
|
||||
m0RTTInProgress = false;
|
||||
@ -3226,16 +3223,14 @@ void nsHttpTransaction::MaybeCancelFallbackTimer() {
|
||||
void nsHttpTransaction::OnBackupConnectionReady() {
|
||||
LOG(("nsHttpTransaction::OnBackupConnectionReady [%p] mConnected=%d", this,
|
||||
mConnected));
|
||||
if (mConnected || mClosed) {
|
||||
if (mConnected || mClosed || mRestarted) {
|
||||
return;
|
||||
}
|
||||
|
||||
HandleFallback(mBackupConnInfo);
|
||||
|
||||
mCaps |= NS_HTTP_DISALLOW_HTTP3;
|
||||
DebugOnly<nsresult> rv =
|
||||
mRequestHead->SetHeader(nsHttp::Alternate_Service_Used, "0"_ns);
|
||||
MOZ_ASSERT(NS_SUCCEEDED(rv));
|
||||
RemoveAlternateServiceUsedHeader(mRequestHead);
|
||||
}
|
||||
|
||||
void nsHttpTransaction::OnHttp3BackupTimer() {
|
||||
|
Loading…
Reference in New Issue
Block a user