From 1668a22b7070ce5132dce3a4c27511558664cdd4 Mon Sep 17 00:00:00 2001 From: Dragana Damjanovic Date: Fri, 26 Feb 2021 10:11:00 +0000 Subject: [PATCH] Bug 1689550 - Add a pref to disable 0RTT only for HTTP3 r=necko-reviewers,valentin Differential Revision: https://phabricator.services.mozilla.com/D106560 --- modules/libpref/init/StaticPrefList.yaml | 5 +++++ netwerk/protocol/http/Http3Session.cpp | 6 ++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/modules/libpref/init/StaticPrefList.yaml b/modules/libpref/init/StaticPrefList.yaml index 5e0399bbba38..7c7837c6a88c 100644 --- a/modules/libpref/init/StaticPrefList.yaml +++ b/modules/libpref/init/StaticPrefList.yaml @@ -8916,6 +8916,11 @@ value: false mirror: always +- name: network.http.http3.enable_0rtt + type: RelaxedAtomicBool + value: true + mirror: always + # When a h3 transaction is inserted in the pending queue, the time (ms) we wait # to create a TCP backup connection. - name: network.http.http3.backup_timer_delay diff --git a/netwerk/protocol/http/Http3Session.cpp b/netwerk/protocol/http/Http3Session.cpp index de4777820657..f1e9ff125d94 100644 --- a/netwerk/protocol/http/Http3Session.cpp +++ b/netwerk/protocol/http/Http3Session.cpp @@ -186,7 +186,8 @@ nsresult Http3Session::Init(const nsHttpConnectionInfo* aConnInfo, nsAutoCString peerId; mSocketControl->GetPeerId(peerId); nsTArray token; - if (NS_SUCCEEDED(SSLTokensCache::Get(peerId, token))) { + if (StaticPrefs::network_http_http3_enable_0rtt() && + NS_SUCCEEDED(SSLTokensCache::Get(peerId, token))) { LOG(("Found a resumption token in the cache.")); mHttp3Connection->SetResumptionToken(token); if (mHttp3Connection->IsZeroRtt()) { @@ -487,7 +488,8 @@ nsresult Http3Session::ProcessEvents() { break; case Http3Event::Tag::ResumptionToken: { LOG(("Http3Session::ProcessEvents - ResumptionToken")); - if (!data.IsEmpty()) { + if (StaticPrefs::network_http_http3_enable_0rtt() && + !data.IsEmpty()) { LOG(("Got a resumption token")); nsAutoCString peerId; mSocketControl->GetPeerId(peerId);