From 8418bed7821601539c42804da13c30411b91ccfb Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Sun, 14 May 2017 00:14:37 +0200 Subject: [PATCH] Improved exception handling w/ enabled gzip --- wcfsetup/install/files/lib/system/WCF.class.php | 2 ++ wcfsetup/install/files/lib/util/HeaderUtil.class.php | 8 ++++++++ 2 files changed, 10 insertions(+) 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. * -- 2.20.1