From: Alexander Ebert Date: Sat, 13 May 2017 22:14:37 +0000 (+0200) Subject: Improved exception handling w/ enabled gzip X-Git-Tag: 3.0.5~7 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=8418bed7821601539c42804da13c30411b91ccfb;p=GitHub%2FWoltLab%2FWCF.git Improved exception handling w/ enabled gzip --- diff --git a/wcfsetup/install/files/lib/system/WCF.class.php b/wcfsetup/install/files/lib/system/WCF.class.php index ebf3e7299c..2b26bf95f0 100644 --- a/wcfsetup/install/files/lib/system/WCF.class.php +++ b/wcfsetup/install/files/lib/system/WCF.class.php @@ -34,6 +34,7 @@ use wcf\system\template\EmailTemplateEngine; use wcf\system\template\TemplateEngine; use wcf\system\user\storage\UserStorageHandler; use wcf\util\FileUtil; +use wcf\util\HeaderUtil; use wcf\util\StringUtil; use wcf\util\UserUtil; @@ -251,6 +252,7 @@ class WCF { // must treat the content as if the header did not appear in first place, this // also overrules the gzip header if present @header('Content-Encoding: identity'); + HeaderUtil::exceptionDisableGzip(); } // backwards compatibility diff --git a/wcfsetup/install/files/lib/util/HeaderUtil.class.php b/wcfsetup/install/files/lib/util/HeaderUtil.class.php index 1db10abb77..955450cf8d 100644 --- a/wcfsetup/install/files/lib/util/HeaderUtil.class.php +++ b/wcfsetup/install/files/lib/util/HeaderUtil.class.php @@ -93,6 +93,14 @@ final class HeaderUtil { @header('Pragma: no-cache'); } + /** + * Disables gzip compression on runtime in case of an exception. You should not call + * this method at all, it exists for exception handling only. + */ + public static function exceptionDisableGzip() { + self::$enableGzipCompression = false; + } + /** * Parses the rendered output. *