diff options
author | Andreas Gohr <andi@splitbrain.org> | 2009-01-22 22:50:10 +0100 |
---|---|---|
committer | Andreas Gohr <andi@splitbrain.org> | 2009-01-22 22:50:10 +0100 |
commit | 98bda4fdc7bccbef714bd6480528804bcd3f5586 (patch) | |
tree | 7f26270babd142e6024f2988e5c8f489dd483a49 /lib/exe/css.php | |
parent | d578eae7de9837d20a73ae2f83f7bf3d346d7ed5 (diff) | |
download | rpg-98bda4fdc7bccbef714bd6480528804bcd3f5586.tar.gz rpg-98bda4fdc7bccbef714bd6480528804bcd3f5586.tar.bz2 |
fixed multiple gzip/sendfile problems in css and js dispatchers FS#1571
- Avoid double compression when gzip_output is enabled
- Only compress when gzip_output is enabled
- Do not use x-sendfile for compressed content (content-encoding is not supported)
- Make sure the script terminates after using x-sendfile
- Moved gzip browser support check to init.php
darcs-hash:20090122215010-7ad00-765765d353ff78df5b8704086328c5c699bbe7e0.gz
Diffstat (limited to 'lib/exe/css.php')
-rw-r--r-- | lib/exe/css.php | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/lib/exe/css.php b/lib/exe/css.php index 9fb247496..7fa56f4cc 100644 --- a/lib/exe/css.php +++ b/lib/exe/css.php @@ -8,6 +8,7 @@ if(!defined('DOKU_INC')) define('DOKU_INC',dirname(__FILE__).'/../../'); if(!defined('NOSESSION')) define('NOSESSION',true); // we do not use a session or authentication here (better caching) +if(!defined('DOKU_DISABLE_GZIP_OUTPUT')) define('DOKU_DISABLE_GZIP_OUTPUT',1); // we gzip ourself here require_once(DOKU_INC.'inc/init.php'); require_once(DOKU_INC.'inc/pageutils.php'); require_once(DOKU_INC.'inc/io.php'); @@ -94,14 +95,10 @@ function css_out(){ if($conf['allowdebug']) header("X-CacheUsed: $cache"); // finally send output - if (http_accepts_gzip() && http_gzip_valid($cache)) { + if ($conf['gzip_output'] && http_gzip_valid($cache)) { header('Vary: Accept-Encoding'); header('Content-Encoding: gzip'); - if (!http_sendfile($cache.'.gz')) readfile($cache.".gz"); -# } else if (http_accepts_deflate()) { -# header('Vary: Accept-Encoding'); -# header('Content-Encoding: deflate'); -# readfile($cache.".zip"); + readfile($cache.".gz"); } else { if (!http_sendfile($cache)) readfile($cache); } @@ -140,14 +137,10 @@ function css_out(){ copy($cache,"compress.zlib://$cache.gz"); // finally send output - if (http_accepts_gzip()) { + if ($conf['gzip_output']) { header('Vary: Accept-Encoding'); header('Content-Encoding: gzip'); print gzencode($css,9,FORCE_GZIP); -# } else if (http_accepts_deflate()) { -# header('Vary: Accept-Encoding'); -# header('Content-Encoding: deflate'); -# print gzencode($css,9,FORCE_DEFLATE); } else { print $css; } |