summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2009-04-03 06:59:34 +0000
committerMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2009-04-03 06:59:34 +0000
commitd2a8bc5b40bdceb57d2e23e75ea81ba495e6bbb5 (patch)
tree3e237a07d14804ff090edc88aabb6cfec4065e6d /django
parent8d42902f1908c2fd5a894e082d3a8aead75d1c28 (diff)
Fixed #10681 -- Work around (by ignoring) invalid ETag headers.
This is a hack to work around problems in the Real World. Apparently, Opera 9.64 has been observed sending malformed headers. We now compromise our high principles and simply ignore such bad behaviour. Patch from Ivan Sagalaev. git-svn-id: http://code.djangoproject.com/svn/django/trunk@10370 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django')
-rw-r--r--django/views/decorators/http.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/django/views/decorators/http.py b/django/views/decorators/http.py
index a0d02bc8bb..b51cf9a782 100644
--- a/django/views/decorators/http.py
+++ b/django/views/decorators/http.py
@@ -75,7 +75,15 @@ def condition(etag_func=None, last_modified_func=None):
if if_none_match or if_match:
# There can be more than one ETag in the request, so we
# consider the list of values.
- etags = parse_etags(if_none_match or if_match)
+ try:
+ etags = parse_etags(if_none_match or if_match)
+ except ValueError:
+ # In case of invalid etag ignore all ETag headers.
+ # Apparently Opera sends invalidly quoted headers at times
+ # (we should be returning a 400 response, but that's a
+ # little extreme) -- this is Django bug #10681.
+ if_none_match = None
+ if_match = None
# Compute values (if any) for the requested resource.
if etag_func: