Skip to content

[HTTP Cache] Validation model: Fix header name #3596

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 8, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions book/http_cache.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down