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)
Change History (6)
by , 17 years ago
Attachment: | cache.patch added |
---|
comment:1 by , 17 years ago
comment:2 by , 17 years ago
Keywords: | http added |
---|---|
Owner: | changed from | to
Patch needs improvement: | set |
Status: | new → assigned |
Summary: | [PATCH] Cache midleware should cache HEAD requests → Cache middleware should cache HEAD requests |
Triage Stage: | Unreviewed → Accepted |
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 , 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 , 14 years ago
Severity: | → Normal |
---|---|
Type: | → New feature |
comment:5 by , 14 years ago
Easy pickings: | unset |
---|---|
Resolution: | → fixed |
Status: | assigned → closed |
3 years later, this is no longer relevant as CacheMiddleware
does not discriminate between request methods any more.
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.