Don't send back the gzipped version if we're using

zlib.output_compression in PHP, since that means that the stream is
already compressed.  Fixes ticket 555.
This commit is contained in:
Bharat Mediratta
2009-07-17 16:58:00 -07:00
parent 8a6556b30b
commit e7c6861507
+3 -2
View File
@@ -60,14 +60,15 @@ class Combined_Controller extends Controller {
$cache = Cache::instance();
$use_gzip = function_exists("gzencode") &&
(strpos($input->server("HTTP_ACCEPT_ENCODING"), "gzip") !== false);
stripos($input->server("HTTP_ACCEPT_ENCODING"), "gzip") !== false &&
(int) ini_get("zlib.output_compression") === 0;
if ($use_gzip && $content = $cache->get("{$key}_gz")) {
header("Content-Encoding: gzip");
} else {
// Fall back to non-gzipped if we have to
$content = $cache->get($key);
}
if (empty($content)) {
Kohana::show_404();
}