From 2cb4f8f49128d7bb9e695c515f90bb9232e38557 Mon Sep 17 00:00:00 2001 From: Dorian Niemiec Date: Tue, 2 Apr 2024 11:00:25 +0200 Subject: [PATCH] Change default `dontCompress` regular expressions --- .config.json.kate-swp | Bin 0 -> 1910 bytes .index.html.kate-swp | Bin 0 -> 433 bytes svr.js | 10 +++++----- 3 files changed, 5 insertions(+), 5 deletions(-) create mode 100644 .config.json.kate-swp create mode 100644 .index.html.kate-swp diff --git a/.config.json.kate-swp b/.config.json.kate-swp new file mode 100644 index 0000000000000000000000000000000000000000..2ad9b491e8c9f9e9266798063945459d452e8867 GIT binary patch literal 1910 zcmb7^-%b-z5XSc;{3|umzeZ4Wg`#aKyQDWLUT{?t;~kChfm3^&X!#yhR?T-8)9C(AUJ*tNX-S*C>!%^59 z^}TTD4JswqZ#21Pj%tk~JP)o4FMwOZsRS>^^=v3je5dip-xeXMBkItC-3+#7DE*IJ zsfXM7u^A|6^I&Zrtj&Y9d9XGQhF&@$e~}-|;w(Jr1#}3q4|I*IWo(N;>zZ__2t1HT-!YSC*9n;NPNZ|P+Vj~X7Ec+ll| zM}I1`@)!o^&e-%DyTZR_Xqh!(-6Y~slcWVB%<<7Onw`Ig<7=cw6lx117KuNX>`7r|H4d{F8l}bT3nl!bQ@hzKvhtS|-T6)|z zxF-ALi3@@`!n|OXFejKH%nB|MX2c`Vycb5c=}7wIYVQ9oWiLrF(3}cK;(_oKaXx1b zGoul+C*|nVbj4eNxcDz*F(e!1r3n5Y;`b8b_lcK9d@`~)qNXik%izB73RrFa031sE zA^5ZG23}2shr+8!kH7o4FOR?{5|8eWVjFR_-4n1nr?o`=I#}tK67dbN(t8S~gW+*J nOVpPW^_4_DdN7w#kIxq_A?xAWrpJp9AI6Dmi1%GuFB`uB@J-Oi literal 0 HcmV?d00001 diff --git a/.index.html.kate-swp b/.index.html.kate-swp new file mode 100644 index 0000000000000000000000000000000000000000..3fbb87dba2dfec2c735fc2986c4db20318793dab GIT binary patch literal 433 zcmY*VK}*9h7|p?7Q1#vo4^yO-O%SHAgKM|pL2!slmP3k7$ZTw=rIqp>1@B(`1O66| z-ggs!iTPx4Ti`vu_a*OrNeCg{1us*7T65#aDog!ta6|~%A(xAv@7wpc-Osy^*TvZv zdy$>#mED?C*u`!<(hIhaqlw%eQM4MAbdh64X-; zB3s$;bPH|n0pX^tQ3eWLK+<%9%H-skHIOx$L&=N(+2{>1#C=JBGejHOJ7%Es3TjPx V#ei1|udgAOR9dYcXvG-@M!#f8THpWx literal 0 HcmV?d00001 diff --git a/svr.js b/svr.js index 445b4cc..048f483 100644 --- a/svr.js +++ b/svr.js @@ -1162,7 +1162,7 @@ var stackHidden = false; var exposeServerVersion = true; var rewriteMap = []; var allowStatus = true; -var dontCompress = ["/.*\\.ipxe$/", "/.*\\.flp$/", "/.*\\.img$/", "/.*\\.iso$/", "/.*\\.png$/", "/.*\\.jpg$/", "/.*\\.webp$/", "/.*\\.(?:mp[34]|mov|wm[av]|avi|webm|og[gv]|mk[va])$/"]; +var dontCompress = ["/.*\\.ipxe$/", "/.*\\.(?:jpe?g|png|bmp|tiff|jfif|gif|webp)$/", "/.*\\.(?:[id]mg|iso|flp)$/", "/.*\\.(?:zip|rar|bz2|[gb7x]z|lzma|tar)$/", "/.*\\.(?:mp[34]|mov|wm[av]|avi|webm|og[gv]|mk[va])$/"]; var enableIPSpoofing = false; var sni = {}; var disableNonEncryptedServer = false; @@ -3862,7 +3862,7 @@ if (!cluster.isPrimary) { function canCompress(path, list) { var canCompress = true; for (var i = 0; i < list.length; i++) { - if (createRegex(list[i]).test(path)) { + if (createRegex(list[i], true).test(path)) { canCompress = false; break; } @@ -3879,9 +3879,9 @@ if (!cluster.isPrimary) { } // Check for browser quirks and adjust compression accordingly - if (ext != "html" && ext != "htm" && ext != "xhtml" && ext != "xht" && ext != "shtml" && /^Mozilla\/4\.[0-9]+(( *\[[^)]*\] *| *)\([^)\]]*\))? *$/.test(req.headers["user-agent"]) && !(/https?:\/\/|[bB][oO][tT]|[sS][pP][iI][dD][eE][rR]|[sS][uU][rR][vV][eE][yY]|MSI[E]/.test(req.headers["user-agent"]))) { + if (ext != "html" && ext != "htm" && ext != "xhtml" && ext != "xht" && ext != "shtml" && /^Mozilla\/4\.[0-9]+(( *\[[^)]*\] *| *)\([^)\]]*\))? *$/.test(req.headers["user-agent"]) && !(/https?:\/\/|[bB][oO][tT]|[sS][pP][iI][dD][eE][rR]|[sS][uU][rR][vV][eE][yY]|MSIE/.test(req.headers["user-agent"]))) { isCompressable = false; // Netscape 4.x doesn't handle compressed data properly outside of HTML documents. - } else if (/^Mozilla\/4\.0[6-8](( *\[[^)]*\] *| *)\([^)\]]*\))? *$/.test(req.headers["user-agent"]) && !(/https?:\/\/|[bB][oO][tT]|[sS][pP][iI][dD][eE][rR]|[sS][uU][rR][vV][eE][yY]|MSI[E]/.test(req.headers["user-agent"]))) { + } else if (/^Mozilla\/4\.0[6-8](( *\[[^)]*\] *| *)\([^)\]]*\))? *$/.test(req.headers["user-agent"]) && !(/https?:\/\/|[bB][oO][tT]|[sS][pP][iI][dD][eE][rR]|[sS][uU][rR][vV][eE][yY]|MSIE/.test(req.headers["user-agent"]))) { isCompressable = false; // Netscape 4.06-4.08 doesn't handle compressed data properly. } else if (ext != "html" && ext != "htm" && ext != "xhtml" && ext != "xht" && ext != "shtml" && /^w3m\/[^ ]*$/.test(req.headers["user-agent"])) { isCompressable = false; // w3m doesn't handle compressed data properly outside of HTML documents. @@ -5623,7 +5623,7 @@ function saveConfig() { if (configJSONobj.disableServerSideScriptExpose === undefined) configJSONobj.disableServerSideScriptExpose = true; if (configJSONobj.allowStatus === undefined) configJSONobj.allowStatus = true; if (configJSONobj.rewriteMap === undefined) configJSONobj.rewriteMap = []; - if (configJSONobj.dontCompress === undefined) configJSONobj.dontCompress = ["/.*\\.ipxe$/", "/.*\\.flp$/", "/.*\\.img$/", "/.*\\.iso$/", "/.*\\.png$/", "/.*\\.jpg$/", "/.*\\.webp$/", "/.*\\.(?:mp[34]|mov|wm[av]|avi|webm|og[gv]|mk[va])$/"]; + if (configJSONobj.dontCompress === undefined) configJSONobj.dontCompress = ["/.*\\.ipxe$/", "/.*\\.(?:jpe?g|png|bmp|tiff|jfif|gif|webp)$/", "/.*\\.(?:[id]mg|iso|flp)$/", "/.*\\.(?:zip|rar|bz2|[gb7x]z|lzma|tar)$/", "/.*\\.(?:mp[34]|mov|wm[av]|avi|webm|og[gv]|mk[va])$/"]; if (configJSONobj.enableIPSpoofing === undefined) configJSONobj.enableIPSpoofing = false; if (configJSONobj.secure === undefined) configJSONobj.secure = false; if (configJSONobj.disableNonEncryptedServer === undefined) configJSONobj.disableNonEncryptedServer = false;