From b87c1adac0dbe0272821361360361fadfe50eae7 Mon Sep 17 00:00:00 2001 From: zefie Date: Mon, 9 Aug 2021 18:57:29 -0400 Subject: [PATCH] don't compress files under 256 bytes --- zefie_wtvp_minisrv/app.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/zefie_wtvp_minisrv/app.js b/zefie_wtvp_minisrv/app.js index 054fce31..9542895f 100644 --- a/zefie_wtvp_minisrv/app.js +++ b/zefie_wtvp_minisrv/app.js @@ -742,8 +742,9 @@ async function sendToClient(socket, headers_obj, data) { } // if box can do compression, see if its worth enabling - var compression_type = shouldWeCompress(socket.ssid, headers_obj); - if (headers_obj["wtv-modern-content-type"]) delete headers_obj["wtv-modern-content-type"]; + // small files actually get larger, so don't compress them + var compression_type = 0; + if (content_length >= 256) compression_type = shouldWeCompress(socket.ssid, headers_obj); // compress if needed if (compression_type > 0 && content_length > 0 && headers_obj['http_response'].substring(0,3) == "200") {