From f7ef7c0fe482763796229ac58aad61449ecec2d9 Mon Sep 17 00:00:00 2001 From: Philipp Rieber Date: Sat, 22 Feb 2014 06:08:31 +0100 Subject: [PATCH] [HTTP Cache] Validation model: Fix header name --- book/http_cache.rst | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/book/http_cache.rst b/book/http_cache.rst index a902861dcc0..620b647d341 100644 --- a/book/http_cache.rst +++ b/book/http_cache.rst @@ -572,9 +572,16 @@ To see a simple implementation, generate the ETag as the md5 of the content:: } The :method:`Symfony\\Component\\HttpFoundation\\Response::isNotModified` -method compares the ``ETag`` sent with the ``Request`` with the one set -on the ``Response``. If the two match, the method automatically sets the -``Response`` status code to 304. +method compares the ``If-None-Match`` sent with the ``Request`` with the +``ETag`` header set on the ``Response``. If the two match, the method +automatically sets the ``Response`` status code to 304. + +.. note:: + + The ``If-None-Match`` request header equals the ``ETag`` header of the + last response sent to the client for the particular resource. This is + how the client and server communicate with each other and decide whether + or not the resource has been updated since it was cached. This algorithm is simple enough and very generic, but you need to create the whole ``Response`` before being able to compute the ETag, which is sub-optimal.