Permalink
Browse files

Fixed #3206 -- Changed ETag comparison to only return 304 when the no…

…rmal

status code would be in the range 200 - 299. This matches RFC 2616
requirements. Based on a patch from Vinay Sajip.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@5407 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
1 parent 9b94115 commit 63a1304f544e2af5b81c3e1bf67441478c23ee39 @malcolmt malcolmt committed Jun 1, 2007
Showing with 1 addition and 1 deletion.
  1. +1 −1 django/middleware/common.py
@@ -75,7 +75,7 @@ def process_response(self, request, response):
# Use ETags, if requested.
if settings.USE_ETAGS:
etag = md5.new(response.content).hexdigest()
- if request.META.get('HTTP_IF_NONE_MATCH') == etag:
+ if response.status_code >= 200 and response.status_code < 300 and response.statusrequest.META.get('HTTP_IF_NONE_MATCH') == etag:
response = http.HttpResponseNotModified()
else:
response['ETag'] = etag

0 comments on commit 63a1304

Please sign in to comment.