Opened 17 years ago

Closed 14 years ago

#6173 closed New feature (fixed)

Cache middleware should cache HEAD requests

Reported by: eratothene Owned by: arien
Component: Core (Cache system) Version: dev
Severity: Normal Keywords: http
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

When conditional get middleware was responsible for HEAD request, the side effects of incorrect middleware ordering could cause striped responses to be cached that is why HEAD requests, where not cached before.
Now HEAD requests content stripping is guarunteed to came after every middleware (applied in responce fixes) so it is safe to cache HEAD request now.

Attachments (1)

cache.patch (832 bytes ) - added by eratothene 17 years ago.

Download all attachments as: .zip

Change History (6)

by eratothene, 17 years ago

Attachment: cache.patch added

comment:1 by eratothene, 17 years ago

Comment on why I have deleted the method check completely: request method is checked in process_request, hence there is no need to check it again.

comment:2 by arien, 17 years ago

Keywords: http added
Owner: changed from nobody to arien
Patch needs improvement: set
Status: newassigned
Summary: [PATCH] Cache midleware should cache HEAD requestsCache middleware should cache HEAD requests
Triage Stage: UnreviewedAccepted

Yeah, that'd be nice to have.

One note about the patch: instead of removing the check for the HTTP method, IMHO it'd be better to factor out the logic for deciding if the cache could be used (the not request.method in ('GET', 'HEAD') or request.GET in process_request) and use that in both process_request and process_response.

comment:3 by arien, 17 years ago

Patch needs improvement: unset

Hmm, never mind the last comment; I think I was looking at an earlier version of your patch(?). request._cache_update_cache would now be the central point deciding whether or not to use the cache.

comment:4 by Gabriel Hurley, 14 years ago

Severity: Normal
Type: New feature

comment:5 by Julien Phalip, 14 years ago

Easy pickings: unset
Resolution: fixed
Status: assignedclosed

3 years later, this is no longer relevant as CacheMiddleware does not discriminate between request methods any more.

Note: See TracTickets for help on using tickets.
Back to Top