Skip to content

Commit d5cf729

Browse files
committed
Bug 1975014: Add a pref for Compression Dictionaries r=necko-reviewers,kershaw
Differential Revision: https://phabricator.services.mozilla.com/D255666
1 parent 85e6192 commit d5cf729

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

modules/libpref/init/StaticPrefList.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15751,6 +15751,12 @@
1575115751
value: false
1575215752
mirror: always
1575315753

15754+
# Enable HTTP Compression Dictionary support
15755+
- name: network.http.dictionaries.enable
15756+
type: RelaxedAtomicBool
15757+
value: true
15758+
mirror: always
15759+
1575415760
#---------------------------------------------------------------------------
1575515761
# Prefs starting with "nglayout."
1575615762
#---------------------------------------------------------------------------

netwerk/protocol/http/nsHttpChannel.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5935,7 +5935,9 @@ nsresult DoAddCacheEntryHeaders(nsHttpChannel* self, nsICacheEntry* entry,
59355935
if (NS_FAILED(rv)) return rv;
59365936

59375937
// If this is being marked as a dictionary, add it to the list
5938-
self->ParseDictionary(entry, responseHead);
5938+
if (StaticPrefs::network_http_dictionaries_enable() && self->IsHTTPS()) {
5939+
self->ParseDictionary(entry, responseHead);
5940+
}
59395941

59405942
// Indicate we have successfully finished setting metadata on the cache entry.
59415943
rv = entry->MetaDataReady();

netwerk/protocol/http/nsHttpHandler.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -665,9 +665,8 @@ nsresult nsHttpHandler::AddAcceptAndDictionaryHeaders(
665665
// XXX This would require that AddAcceptAndDictionaryHeaders be effectively
666666
// async, perhaps by passing a lambda to call AddAcceptAndDictionaryHeaders
667667
// and then unblock the request
668-
aDict =
669-
mDictionaryCache ? mDictionaryCache->GetDictionaryFor(aURI) : nullptr;
670-
if (aDict) {
668+
if (StaticPrefs::network_http_dictionaries_enable() &&
669+
(aDict = mDictionaryCache->GetDictionaryFor(aURI))) {
671670
rv = aRequest->SetHeader(nsHttp::Accept_Encoding,
672671
mDictionaryAcceptEncodings, false,
673672
nsHttpHeaderArray::eVarietyRequestOverride);

0 commit comments

Comments
 (0)