diff options
author | Simon Rettberg | 2013-11-27 19:23:16 +0100 |
---|---|---|
committer | Simon Rettberg | 2013-11-27 19:23:16 +0100 |
commit | 1b4b4c918b93cf70c78ad265a940d4edd8269db1 (patch) | |
tree | c12213b87d30028eaff8d375d7fde40af2be5a1e /inc/render.inc.php | |
parent | Make default boot entry selectable (also fix menu timeout) (diff) | |
download | slx-admin-1b4b4c918b93cf70c78ad265a940d4edd8269db1.tar.gz slx-admin-1b4b4c918b93cf70c78ad265a940d4edd8269db1.tar.xz slx-admin-1b4b4c918b93cf70c78ad265a940d4edd8269db1.zip |
Add gzip compression to output
Diffstat (limited to 'inc/render.inc.php')
-rw-r--r-- | inc/render.inc.php | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/inc/render.inc.php b/inc/render.inc.php index dfe91ccb..1ab93965 100644 --- a/inc/render.inc.php +++ b/inc/render.inc.php @@ -32,6 +32,8 @@ class Render public static function output() { Header('Content-Type: text/html; charset=utf-8'); + $zip = (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== false); + if ($zip) ob_start(); echo '<!DOCTYPE html> <html> @@ -56,6 +58,14 @@ class Render <script src="script/custom.js"></script></body> </html>' ; + if ($zip) { + Header('Content-Encoding: gzip'); + ob_implicit_flush(false); + $gzip_contents = ob_get_contents(); + ob_end_clean(); + echo "\x1f\x8b\x08\x00\x00\x00\x00\x00"; + echo substr(gzcompress($gzip_contents, 5), 0, -4); + } } /** |