Skip to content

Commit

Permalink
Support disabling advanced setting cacheControlForFirefox1376932
Browse files Browse the repository at this point in the history
Related feedback:
- uBlockOrigin/uBlock-issues#229 (comment)

Setting `cacheControlForFirefox1376932` to `unset` will
prevent modification of the `Cache-Control` header.
  • Loading branch information
gorhill committed Aug 13, 2019
1 parent 970164e commit 52925ba
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/js/traffic.js
Original file line number Diff line number Diff line change
Expand Up @@ -483,14 +483,16 @@ const onHeadersReceived = function(details) {
// Use `no-cache` instead of `no-cache, no-store, must-revalidate`, this
// allows Firefox's offline mode to work as expected.
if ( (filteredHTML || modifiedHeaders) && dontCacheResponseHeaders ) {
let i = headerIndexFromName('cache-control', responseHeaders);
let cacheControl = µb.hiddenSettings.cacheControlForFirefox1376932;
if ( i !== -1 ) {
responseHeaders[i].value = cacheControl;
} else {
responseHeaders.push({ name: 'Cache-Control', value: cacheControl });
if ( cacheControl !== 'unset' ) {
let i = headerIndexFromName('cache-control', responseHeaders);
if ( i !== -1 ) {
responseHeaders[i].value = cacheControl;
} else {
responseHeaders.push({ name: 'Cache-Control', value: cacheControl });
}
modifiedHeaders = true;
}
modifiedHeaders = true;
}

if ( modifiedHeaders ) {
Expand Down

0 comments on commit 52925ba

Please sign in to comment.