From 418426419db11ad720245e7f3283a70f55e2c250 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABl=20M=C3=A9tais?= Date: Sun, 28 Feb 2021 13:59:16 +0000 Subject: [PATCH] Improve compression detection --- lib/metadata/policies.js | 2 +- lib/tools/redownload/redownload.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/metadata/policies.js b/lib/metadata/policies.js index 1d9a606..f76c01f 100644 --- a/lib/metadata/policies.js +++ b/lib/metadata/policies.js @@ -758,7 +758,7 @@ var policies = { "compression": { "tool": "redownload", "label": "Gzip/Brotli compression", - "message": "

Measures the number of bytes that could be saved by compressing textual files. Some files listed below might not be compressed at all, some might be already compressed with Gzip but would become even lighter with Brotli.

All major server systems are now compatible with Brotli.

Note that compressing small files (< 1 KB) is arguable, and that some assets such as images should not be compressed as it is already included in their format. Here is a list of Content-Types that should be compressed.

", + "message": "

Measures the number of bytes that could be saved by compressing textual files. Some files listed below might not be compressed at all, some might be already compressed with Gzip but would become even lighter with Brotli.

All major server systems are now compatible with Brotli.

Note that compressing small files (< 1 KB) is arguable, and that some assets such as images should not be compressed as it is already included in their format. Here is a list of MIME types that should be compressed.

", "isOkThreshold": 20480, "isBadThreshold": 204800, "isAbnormalThreshold": 409600, diff --git a/lib/tools/redownload/redownload.js b/lib/tools/redownload/redownload.js index 3b544f8..82793ad 100644 --- a/lib/tools/redownload/redownload.js +++ b/lib/tools/redownload/redownload.js @@ -823,6 +823,7 @@ var Redownload = function() { reqHeaders['Accept'] = '*/*,image/webp'; reqHeaders['Accept-Encoding'] = 'gzip, deflate, br'; reqHeaders['Connection'] = 'keep-alive'; + reqHeaders['User-Agent'] = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.182 Safari/537.36'; var requestOptions = { method: entry.method,