1
0
mirror of https://github.com/django/django.git synced 2025-10-23 21:59:11 +00:00

Fixed #14560 -- Enable HEAD requests to be cached properly. Thanks, codemonkey!

Introducing ability to cache HEAD requests and GET requests separately by
adding the method to the cache key while preserving the functionality that HEAD
requests can use cached reponses generated by a GET request.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@14391 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Honza Král
2010-10-29 01:31:15 +00:00
parent 8a724802c5
commit cb17f7ca22
4 changed files with 86 additions and 22 deletions

View File

@@ -328,7 +328,9 @@ parameters. Optionally, if the ``CACHE_MIDDLEWARE_ANONYMOUS_ONLY`` setting is
will be cached. This is a simple and effective way of disabling caching for any
user-specific pages (include Django's admin interface). Note that if you use
``CACHE_MIDDLEWARE_ANONYMOUS_ONLY``, you should make sure you've activated
``AuthenticationMiddleware``.
``AuthenticationMiddleware``. The cache middleware expects that a HEAD request
is answered with the same response headers exactly like the corresponding GET
request, in that case it could return cached GET response for HEAD request.
Additionally, the cache middleware automatically sets a few headers in each
``HttpResponse``: