don't compress files under 256 bytes

This commit is contained in:
zefie
2021-08-09 18:57:29 -04:00
parent e359644998
commit b87c1adac0

View File

@@ -742,8 +742,9 @@ async function sendToClient(socket, headers_obj, data) {
} }
// if box can do compression, see if its worth enabling // if box can do compression, see if its worth enabling
var compression_type = shouldWeCompress(socket.ssid, headers_obj); // small files actually get larger, so don't compress them
if (headers_obj["wtv-modern-content-type"]) delete headers_obj["wtv-modern-content-type"]; var compression_type = 0;
if (content_length >= 256) compression_type = shouldWeCompress(socket.ssid, headers_obj);
// compress if needed // compress if needed
if (compression_type > 0 && content_length > 0 && headers_obj['http_response'].substring(0,3) == "200") { if (compression_type > 0 && content_length > 0 && headers_obj['http_response'].substring(0,3) == "200") {