? boost-613926.1.patch ? boost-623784.patch ? boost-625962.patch ? boost-626634.patch Index: boost.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/boost/boost.module,v retrieving revision 1.3.2.2.2.5.2.238 diff -u -p -r1.3.2.2.2.5.2.238 boost.module --- boost.module 8 Nov 2009 07:29:38 -0000 1.3.2.2.2.5.2.238 +++ boost.module 9 Nov 2009 05:22:43 -0000 @@ -1351,6 +1351,15 @@ function boost_get_http_status() { } } +function boost_headers_contain($text) { + if (function_exists(headers_list)) { + return stristr(implode(' ', headers_list()), $text);; + } + else { + return FALSE; + } +} + ////////////////////////////////////////////////////////////////////////////// // Boost API implementation @@ -2071,13 +2080,13 @@ function boost_cache_set($path, $data, $ // Special handling of the front page for aggressive gzip test if ($path == '' && BOOST_AGGRESSIVE_GZIP && $extension == BOOST_FILE_EXTENSION) { _boost_generate_gzip_test_file(); - boost_cache_write($filename, _boost_inject_code($data, '' . "\n")); + boost_cache_write($filename, _boost_inject_code($data, '' . "\n"), 0); } else { - boost_cache_write($filename, $data); + boost_cache_write($filename, $data, 0); } if (BOOST_GZIP) { - boost_cache_write(str_replace(BOOST_FILE_PATH, BOOST_GZIP_FILE_PATH, $filename) . BOOST_GZIP_EXTENSION, gzencode($data, 9)); + boost_cache_write(str_replace(BOOST_FILE_PATH, BOOST_GZIP_FILE_PATH, $filename) . BOOST_GZIP_EXTENSION, $data, 1); } if (!BOOST_NO_DATABASE) { boost_db_prep($filename, $extension, BOOST_TIME + $expire); @@ -2551,8 +2560,23 @@ function boost_get_time($table, $column) * Name of file to be written * @param $data * Contents of file - */ -function boost_cache_write($filename, $data = '') { + * @param $gzip + * Should the contents be gzipped? + * 0 = No + * 1 = Yes + * 2 = Yes & decompress & recompress + */ +function boost_cache_write($filename, $data, $gzip) { + if (boost_headers_contain('gzip') && $gzip == 0) { + $data = gzinflate(substr(substr($data, 10), 0, -8)); + } + if (!boost_headers_contain('gzip') && $gzip == 1) { + $data = gzencode($data, 9); + } + if (boost_headers_contain('gzip') && $gzip == 2) { + $data = gzinflate(substr(substr($data, 10), 0, -8)); + $data = gzencode($data, 9); + } if (!_boost_mkdir_p(dirname($filename))) { if (BOOST_VERBOSE >= 3) { watchdog('boost', 'Unable to create directory: %dir
Group ID: %gid
User ID: %uid
Current script owner: %user
', array('%dir' => dirname($filename), '%gid' => getmygid(), '%uid' => getmyuid(), '%user' => get_current_user()), WATCHDOG_WARNING);