diff options
author | Dries Buytaert <dries@buytaert.net> | 2007-10-25 15:38:25 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2007-10-25 15:38:25 +0000 |
commit | ca0bbfee5b79cec35beccedd7ce0d72455799ab2 (patch) | |
tree | c2d0d8e4d3194525023e0bab45a28149d31e4d6e /includes | |
parent | 1cf05b0019dbacb1d92297fb334369b23f253834 (diff) | |
download | brdo-ca0bbfee5b79cec35beccedd7ce0d72455799ab2.tar.gz brdo-ca0bbfee5b79cec35beccedd7ce0d72455799ab2.tar.bz2 |
- Modified version of patch #121820 by Caleb et al: add an option for page compression.
Diffstat (limited to 'includes')
-rw-r--r-- | includes/bootstrap.inc | 16 | ||||
-rw-r--r-- | includes/common.inc | 9 |
2 files changed, 14 insertions, 11 deletions
diff --git a/includes/bootstrap.inc b/includes/bootstrap.inc index 11f69c539..18f1902a9 100644 --- a/includes/bootstrap.inc +++ b/includes/bootstrap.inc @@ -607,13 +607,15 @@ function drupal_page_cache_header($cache) { header("Expires: Sun, 19 Nov 1978 05:00:00 GMT"); header("Cache-Control: must-revalidate"); - // Determine if the browser accepts gzipped data. - if (@strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') === FALSE && function_exists('gzencode')) { - // Strip the gzip header and run uncompress. - $cache->data = gzinflate(substr(substr($cache->data, 10), 0, -8)); - } - elseif (function_exists('gzencode')) { - header('Content-Encoding: gzip'); + if (variable_get('page_compression', TRUE)) { + // Determine if the browser accepts gzipped data. + if (@strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') === FALSE && function_exists('gzencode')) { + // Strip the gzip header and run uncompress. + $cache->data = gzinflate(substr(substr($cache->data, 10), 0, -8)); + } + elseif (function_exists('gzencode')) { + header('Content-Encoding: gzip'); + } } // Send the original request's headers. We send them one after diff --git a/includes/common.inc b/includes/common.inc index d2a3b92a3..0524982c4 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -673,14 +673,15 @@ function fix_gpc_magic() { * @endcode * * - @variable, which indicates that the text should be run through check_plain, - * to strip out HTML characters. Use this for any output that's displayed within + * to escape HTML characters. Use this for any output that's displayed within * a Drupal page. * @code * drupal_set_title($title = t("@name's blog", array('@name' => $account->name))); * @endcode * - * - %variable, which indicates that the string should be highlighted with - * theme_placeholder() which shows up by default as <em>emphasized</em>. + * - %variable, which indicates that the string should be HTML escaped and + * highlighted with theme_placeholder() which shows up by default as + * <em>emphasized</em>. * @code * $message = t('%name-from sent %name-to an e-mail.', array('%name-from' => $user->name, '%name-to' => $account->name)); * @endcode @@ -2391,7 +2392,7 @@ function page_set_cache() { // This will fail in some cases, see page_get_cache() for the explanation. if ($data = ob_get_contents()) { $cache = TRUE; - if (function_exists('gzencode')) { + if (variable_get('page_compression', TRUE) && 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') { |