# HG changeset patch # User Tom Fredrik "BFG" Klaussen # Date 1458042942 -3600 # Node ID adf7b11921f4bb962939fe826d3bc0666e7a268a # Parent 6f5939bf53c3bdeeecf32c1cabcec24b8a6662f9 No compression when debugging. Synchronize caching headers. diff -r 6f5939bf53c3 -r adf7b11921f4 CacheTimeCheck.inc --- a/CacheTimeCheck.inc Tue Mar 08 00:43:48 2016 +0100 +++ b/CacheTimeCheck.inc Tue Mar 15 12:55:42 2016 +0100 @@ -26,15 +26,15 @@ //print_r($gmdate_mod); } + foreach($cache->cacheControl() as $header => $value) { + header ("${header}: ${value}"); + } if(array_key_exists('HTTP_IF_MODIFIED_SINCE', $_SERVER)) { $HTTP_IF_MODIFIED_SINCE = $_SERVER['HTTP_IF_MODIFIED_SINCE']; $if_modified_since = preg_replace('/;.*$/', '', $HTTP_IF_MODIFIED_SINCE); if (strtotime($if_modified_since) >= $cache->getNewest()) { header("HTTP/1.0 304 Not Modified"); - foreach($cache->cacheControl() as $header => $value) { - header ("${header}: ${value}"); - } return false; } } diff -r 6f5939bf53c3 -r adf7b11921f4 FileCacheSet.inc --- a/FileCacheSet.inc Tue Mar 08 00:43:48 2016 +0100 +++ b/FileCacheSet.inc Tue Mar 15 12:55:42 2016 +0100 @@ -13,7 +13,12 @@ } function cacheControl() { - return array("expires" => toGMTime(time()+$this->max_age), "cache-control" => "public, max-age=$this->max_age"); + if ($this->max_age > 0) { + return array("expires" => toGMTime(time()+$this->max_age), "cache-control" => "public, max-age=$this->max_age"); + } + else { + return array("expires" => 0, "cache-control" => "public, max-age=0, no-cache"); + } } }; diff -r 6f5939bf53c3 -r adf7b11921f4 InputParser.inc --- a/InputParser.inc Tue Mar 08 00:43:48 2016 +0100 +++ b/InputParser.inc Tue Mar 15 12:55:42 2016 +0100 @@ -63,7 +63,7 @@ } } $this->master = self::getFiles($this->master, $this->options); - $cache->setMaxAge(20); + $cache->setMaxAge(0); } function cacheCheck() diff -r 6f5939bf53c3 -r adf7b11921f4 Page.inc --- a/Page.inc Tue Mar 08 00:43:48 2016 +0100 +++ b/Page.inc Tue Mar 15 12:55:42 2016 +0100 @@ -110,6 +110,8 @@ */ function mayCompress() { + if (COMPRESSION_DISABLED) + return false; //We want to add the variant even if we don't serve with compression. $this->addVariant('Accept-Encoding'); if (!array_key_exists('HTTP_ACCEPT_ENCODING', $_SERVER)) diff -r 6f5939bf53c3 -r adf7b11921f4 constants.inc --- a/constants.inc Tue Mar 08 00:43:48 2016 +0100 +++ b/constants.inc Tue Mar 15 12:55:42 2016 +0100 @@ -9,6 +9,7 @@ define(VERBOSITY_DEBUG, 100); define(DEBUG_LEVEL, VERBOSITY_NONE); +define(COMPRESSION_DISABLED, 0); define(DUMP, 0); define(MAX_RECURSE, 50);