Browse Source

[HttpKernel] Suppress response content for 304 responses out of the cache

Fixes #1413
Jordi Boggiano 14 years ago
parent
commit
05c990628b
1 changed files with 2 additions and 2 deletions
  1. 2 2
      src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php

+ 2 - 2
src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php

@@ -55,7 +55,7 @@ class HttpCache implements HttpKernelInterface
      *
      *   * allow_revalidate       Specifies whether the client can force a cache revalidate by including
      *                            a Cache-Control "max-age=0" directive in the request. Set it to ``true``
-      *                            for compliance with RFC 2616. (default: false)
+     *                            for compliance with RFC 2616. (default: false)
      *
      *   * stale_while_revalidate Specifies the default number of seconds (the granularity is the second as the
      *                            Response TTL precision is a second) during which the cache can immediately return
@@ -550,7 +550,7 @@ class HttpCache implements HttpKernelInterface
      */
     private function restoreResponseBody(Request $request, Response $response)
     {
-        if ('head' === strtolower($request->getMethod())) {
+        if ('head' === strtolower($request->getMethod()) || 304 === $response->getStatusCode()) {
             $response->setContent('');
             $response->headers->remove('X-Body-Eval');
             $response->headers->remove('X-Body-File');