diff options
| author | Adrian Holovaty <adrian@holovaty.com> | 2008-06-16 04:13:04 +0000 |
|---|---|---|
| committer | Adrian Holovaty <adrian@holovaty.com> | 2008-06-16 04:13:04 +0000 |
| commit | 02bbd9a9b28de27748e0663e63a68ac66024bd73 (patch) | |
| tree | dbfe27487ad0d2a4c5d1b74d5e4775d4d58f3351 | |
| parent | 4094d03e290c25c52024302f8e470055170064f0 (diff) | |
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
| -rw-r--r-- | django/middleware/common.py | 2 | ||||
| -rw-r--r-- | django/utils/cache.py | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/django/middleware/common.py b/django/middleware/common.py index 3d57fa4367..5cb7ca1bd3 100644 --- a/django/middleware/common.py +++ b/django/middleware/common.py @@ -108,7 +108,7 @@ class CommonMiddleware(object): if response.has_header('ETag'): etag = response['ETag'] else: - etag = md5.new(response.content).hexdigest() + etag = '"%s"' % md5.new(response.content).hexdigest() if response.status_code >= 200 and response.status_code < 300 and request.META.get('HTTP_IF_NONE_MATCH') == etag: cookies = response.cookies response = http.HttpResponseNotModified() diff --git a/django/utils/cache.py b/django/utils/cache.py index 4fcf493944..603199cc7e 100644 --- a/django/utils/cache.py +++ b/django/utils/cache.py @@ -104,7 +104,7 @@ def patch_response_headers(response, cache_timeout=None): if cache_timeout < 0: cache_timeout = 0 # Can't have max-age negative if not response.has_header('ETag'): - response['ETag'] = md5.new(response.content).hexdigest() + response['ETag'] = '"%s"' % md5.new(response.content).hexdigest() if not response.has_header('Last-Modified'): response['Last-Modified'] = http_date() if not response.has_header('Expires'): |
