From ef72a875e52383b30fc315fa340d703699e7ec5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= Date: Sun, 4 Mar 2012 17:16:25 +0100 Subject: [PATCH] Compress JSON with GZip if enabled --- file/lib/page/ChatMessagePage.class.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/file/lib/page/ChatMessagePage.class.php b/file/lib/page/ChatMessagePage.class.php index 81ac24a..4b1a5d9 100644 --- a/file/lib/page/ChatMessagePage.class.php +++ b/file/lib/page/ChatMessagePage.class.php @@ -66,6 +66,11 @@ public function show() { parent::show(); @header('Content-type: application/json'); + // enable gzip compression + if (HTTP_ENABLE_GZIP && HTTP_GZIP_LEVEL > 0 && HTTP_GZIP_LEVEL < 10 && !defined('HTTP_DISABLE_GZIP')) { + \wcf\util\HeaderUtil::compressOutput(); + } + $json = array('users' => array(), 'messages' => array()); foreach ($this->messages as $message) {