summaryrefslogtreecommitdiff
path: root/includes/common.inc
diff options
context:
space:
mode:
authorDavid Rothstein <drothstein@gmail.com>2013-12-30 11:38:30 -0500
committerDavid Rothstein <drothstein@gmail.com>2013-12-30 11:38:30 -0500
commit6cd1aae9884952d2eb9750133c85c1c52c3ba26f (patch)
treebcc0a742dc9453673f486c619afac53e8d2b4af3 /includes/common.inc
parent001532a06e070f209c2e771720435a3e08c0cc8c (diff)
downloadbrdo-6cd1aae9884952d2eb9750133c85c1c52c3ba26f.tar.gz
brdo-6cd1aae9884952d2eb9750133c85c1c52c3ba26f.tar.bz2
Issue #1476810 by Spleshka, David_Rothstein, franz | Heine: Drupal_serve_page_from_cache can serve uncompressed data with Content-Encoding gzip header with page_cache_without_database = 1.
Diffstat (limited to 'includes/common.inc')
-rw-r--r--includes/common.inc9
1 files changed, 8 insertions, 1 deletions
diff --git a/includes/common.inc b/includes/common.inc
index 9cd73f4e2..38895c542 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -5176,6 +5176,10 @@ function drupal_page_set_cache() {
global $base_root;
if (drupal_page_is_cacheable()) {
+
+ // Check whether the current page might be compressed.
+ $page_compressed = variable_get('page_compression', TRUE) && extension_loaded('zlib');
+
$cache = (object) array(
'cid' => $base_root . request_uri(),
'data' => array(
@@ -5183,6 +5187,9 @@ function drupal_page_set_cache() {
'body' => ob_get_clean(),
'title' => drupal_get_title(),
'headers' => array(),
+ // We need to store whether page was compressed or not,
+ // because by the time it is read, the configuration might change.
+ 'page_compressed' => $page_compressed,
),
'expire' => CACHE_TEMPORARY,
'created' => REQUEST_TIME,
@@ -5200,7 +5207,7 @@ function drupal_page_set_cache() {
}
if ($cache->data['body']) {
- if (variable_get('page_compression', TRUE) && extension_loaded('zlib')) {
+ if ($page_compressed) {
$cache->data['body'] = gzencode($cache->data['body'], 9, FORCE_GZIP);
}
cache_set($cache->cid, $cache->data, 'cache_page', $cache->expire);