From ea4ab77b6d0f6983b67aa7bd856d3873258c6913 Mon Sep 17 00:00:00 2001 From: Marc Weistroff Date: Sun, 6 Feb 2011 16:42:50 -0800 Subject: [PATCH] [HttpKernel] HttpCache now sends maxage=0 cache-control directive in case of Esi presence. --- src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php b/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php index 0b97d8dfa5..cadbfa9f83 100644 --- a/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php +++ b/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php @@ -180,7 +180,7 @@ class HttpCache implements HttpKernelInterface */ protected function addEsiTtl(Response $response) { - $this->esiTtls[] = $response->isValidateable() ? 0 : $response->getTtl(); + $this->esiTtls[] = $response->isValidateable() ? -1 : $response->getTtl(); } /** @@ -192,10 +192,11 @@ class HttpCache implements HttpKernelInterface protected function updateResponseCacheControl(Response $response) { $ttl = min($this->esiTtls); - if (0 === $ttl) { + if (-1 === $ttl) { $response->headers->set('Cache-Control', 'no-cache, must-revalidate'); } else { $response->setSharedMaxAge($ttl); + $response->setMaxAge(0); } }