Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #7228 -- Fixed our ETag header creation to meet the HTTP spec, …

…by quoting it. Thanks, skjohn@us.ibm.com

git-svn-id: http://code.djangoproject.com/svn/django/trunk@7659 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 02bbd9a9b28de27748e0663e63a68ac66024bd73 1 parent 4094d03
Adrian Holovaty authored June 16, 2008
2  django/middleware/common.py
@@ -108,7 +108,7 @@ def process_response(self, request, response):
108 108
             if response.has_header('ETag'):
109 109
                 etag = response['ETag']
110 110
             else:
111  
-                etag = md5.new(response.content).hexdigest()
  111
+                etag = '"%s"' % md5.new(response.content).hexdigest()
112 112
             if response.status_code >= 200 and response.status_code < 300 and request.META.get('HTTP_IF_NONE_MATCH') == etag:
113 113
                 cookies = response.cookies
114 114
                 response = http.HttpResponseNotModified()
2  django/utils/cache.py
@@ -104,7 +104,7 @@ def patch_response_headers(response, cache_timeout=None):
104 104
     if cache_timeout < 0:
105 105
         cache_timeout = 0 # Can't have max-age negative
106 106
     if not response.has_header('ETag'):
107  
-        response['ETag'] = md5.new(response.content).hexdigest()
  107
+        response['ETag'] = '"%s"' % md5.new(response.content).hexdigest()
108 108
     if not response.has_header('Last-Modified'):
109 109
         response['Last-Modified'] = http_date()
110 110
     if not response.has_header('Expires'):

0 notes on commit 02bbd9a

Please sign in to comment.
Something went wrong with that request. Please try again.