Lower maximum Expires value to 4h

Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/2899
This commit is contained in:
Raymond Hill 2023-11-06 19:45:16 -05:00
parent 8ed1ad9c9d
commit 2360bc02f3
No known key found for this signature in database
GPG key ID: 25E1490B761470C2

View file

@ -55,7 +55,7 @@ const parseExpires = s => {
if ( matches === null ) { return 0; }
let updateAfter = parseInt(matches[1], 10);
if ( matches[2] === 'h' ) {
updateAfter = Math.ceil(updateAfter / 6) / 4;
updateAfter = Math.max(updateAfter, 4) / 24;
}
return updateAfter;
};
@ -81,10 +81,10 @@ const extractMetadataFromList = (content, fields) => {
out.lastModified = (new Date(out.lastModified)).getTime() || 0;
}
if ( out.expires ) {
out.expires = Math.max(parseExpires(out.expires), 0.5);
out.expires = parseExpires(out.expires);
}
if ( out.diffExpires ) {
out.diffExpires = Math.max(parseExpires(out.diffExpires), 0.25);
out.diffExpires = parseExpires(out.diffExpires);
}
return out;
};