Index: includes/common.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/common.inc,v retrieving revision 1.517 diff -u -p -r1.517 common.inc --- includes/common.inc 21 Feb 2006 18:46:53 -0000 1.517 +++ includes/common.inc 22 Feb 2006 15:30:50 -0000 @@ -1315,21 +1315,33 @@ function _drupal_bootstrap_full() { function page_set_cache() { global $user, $base_url; - if (!$user->uid && $_SERVER['REQUEST_METHOD'] == 'GET') { + if ($user->uid == 0 && $_SERVER['REQUEST_METHOD'] == 'GET') { // This will fail in some cases, see page_get_cache() for the explanation. if ($data = ob_get_contents()) { $cache = TRUE; if (function_exists('gzencode')) { // We do not store the data in case the zlib mode is deflate. // This should be rarely happening. - if (zlib_get_coding_type() == 'deflate') { - $cache = FALSE; + watchdog('debug', 'encoding: '. $_SERVER['HTTP_ACCEPT_ENCODING']); + watchdog('debug', 'zlib: '. zlib_get_coding_type()); + switch (zlib_get_coding_type()) { + case FALSE: + $data = gzencode($data, 9, FORCE_GZIP); + break; + case 'deflate': + $cache = FALSE; + break; + case 'gzip': + // The remaining case is 'gzip' which means the data is + // already compressed and nothing left to do but to store + // it. However, if the anonymous user does not support + // gzip, then zlib will not compress the data + if(strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') === FALSE) { + $data = gzencode($data, 9, FORCE_GZIP); + watchdog('debug', 'data compressed'); + } + break; } - else if (zlib_get_coding_type() == FALSE) { - $data = gzencode($data, 9, FORCE_GZIP); - } - // The remaining case is 'gzip' which means the data is - // already compressed and nothing left to do but to store it. } ob_end_flush(); if ($cache && $data) {