Bug 1581637 - Part 5 - Add Http3 prefs. r=mayhemer

Differential Revision: https://phabricator.services.mozilla.com/D46651

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Dragana Damjanovic 2019-11-01 14:55:55 +00:00
Родитель eef2d9ae2e
Коммит 16a5162579
4 изменённых файлов: 49 добавлений и 0 удалений

Просмотреть файл

@ -98,6 +98,9 @@ pref("network.http.max-persistent-connections-per-proxy", 20);
pref("network.http.spdy.push-allowance", 32768);
pref("network.http.spdy.default-hpack-buffer", 4096); // 4k
// http3
pref("network.http.http3.default-qpack-table-size", 4096); // 4k
// See bug 545869 for details on why these are set the way they are
pref("network.buffer.cache.count", 24);
pref("network.buffer.cache.size", 16384);

Просмотреть файл

@ -1406,6 +1406,14 @@ pref("network.http.spdy.default-hpack-buffer", 65536); // 64k
pref("network.http.spdy.websockets", true);
pref("network.http.spdy.enable-hpack-dump", false);
// Http3 parameters
pref("network.http.http3.enabled", false);
// Http3 qpack table size.
pref("network.http.http3.default-qpack-table-size", 65536); // 64k
// Maximal number of streams that can be blocked on waiting for qpack
// instructions.
pref("network.http.http3.default-max-stream-blocked", 10);
// alt-svc allows separation of transport routing from
// the origin host without using a proxy.
pref("network.http.altsvc.enabled", true);

Просмотреть файл

@ -280,6 +280,9 @@ nsHttpHandler::nsHttpHandler()
mBug1563538(true),
mBug1563695(true),
mBug1556491(true),
mHttp3Enabled(true),
mQpackTableSize(4096),
mHttp3MaxBlockedStreams(10),
mMaxHttpResponseHeaderSize(393216),
mFocusedWindowTransactionRatio(0.9f),
mSpeculativeConnectEnabled(false),
@ -1917,6 +1920,28 @@ void nsHttpHandler::PrefsChanged(const char* pref) {
}
}
if (PREF_CHANGED(HTTP_PREF("http3.enabled"))) {
rv = Preferences::GetBool(HTTP_PREF("http3.enabled"), &cVar);
if (NS_SUCCEEDED(rv)) {
mHttp3Enabled = cVar;
}
}
if (PREF_CHANGED(HTTP_PREF("http3.default-qpack-table-size"))) {
rv = Preferences::GetInt(HTTP_PREF("http3.default-qpack-table-size"), &val);
if (NS_SUCCEEDED(rv)) {
mQpackTableSize = val;
}
}
if (PREF_CHANGED(HTTP_PREF("http3.default-max-stream-blocked"))) {
rv = Preferences::GetInt(HTTP_PREF("http3.default-max-stream-blocked"),
&val);
if (NS_SUCCEEDED(rv)) {
mHttp3MaxBlockedStreams = clamped(val, 0, 0xffff);
}
}
// Enable HTTP response timeout if TCP Keepalives are disabled.
mResponseTimeoutEnabled =
!mTCPKeepaliveShortLivedEnabled && !mTCPKeepaliveLongLivedEnabled;

Просмотреть файл

@ -439,6 +439,12 @@ class nsHttpHandler final : public nsIHttpProtocolHandler,
bool IsHttp3VersionSupportedHex(const nsACString& version);
nsCString Http3Version() { return kHttp3Version; }
bool IsHttp3Enabled() const { return mHttp3Enabled; }
uint32_t DefaultQpackTableSize() const { return mQpackTableSize; }
uint16_t DefaultHttp3MaxBlockedStreams() const {
return (uint16_t)mHttp3MaxBlockedStreams;
}
uint32_t MaxHttpResponseHeaderSize() const {
return mMaxHttpResponseHeaderSize;
}
@ -689,6 +695,13 @@ class nsHttpHandler final : public nsIHttpProtocolHandler,
Atomic<bool, Relaxed> mBug1563695;
Atomic<bool, Relaxed> mBug1556491;
Atomic<bool, Relaxed> mHttp3Enabled;
// Http3 parameters
Atomic<uint32_t, Relaxed> mQpackTableSize;
Atomic<uint32_t, Relaxed>
mHttp3MaxBlockedStreams; // uint16_t is enough here, but Atomic only
// supports uint32_t or uint64_t.
// The max size (in bytes) for received Http response header.
uint32_t mMaxHttpResponseHeaderSize;