Pārlūkot izejas kodu

Improve compression detection

Gaël Métais 4 gadi atpakaļ
vecāks
revīzija
418426419d
2 mainītis faili ar 2 papildinājumiem un 1 dzēšanām
  1. 1 1
      lib/metadata/policies.js
  2. 1 0
      lib/tools/redownload/redownload.js

+ 1 - 1
lib/metadata/policies.js

@@ -758,7 +758,7 @@ var policies = {
     "compression": {
         "tool": "redownload",
         "label": "Gzip/Brotli compression",
-        "message": "<p>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.</p><p>All major server systems are now compatible with Brotli.</p><p>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. <a href=\"https://gist.github.com/gmetais/971ce13a1fbeebd88445\" target=\"_blank\">Here</a> is a list of Content-Types that should be compressed.</p>",
+        "message": "<p>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.</p><p>All major server systems are now compatible with Brotli.</p><p>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. <a href=\"https://letstalkaboutwebperf.com/en/gzip-brotli-server-config/\" target=\"_blank\">Here</a> is a list of MIME types that should be compressed.</p>",
         "isOkThreshold": 20480,
         "isBadThreshold": 204800,
         "isAbnormalThreshold": 409600,

+ 1 - 0
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,