summaryrefslogtreecommitdiff
path: root/django/utils/http.py
diff options
context:
space:
mode:
authorDenis Cornehl <syphar@fastmail.fm>2016-01-05 08:09:10 +0100
committerTim Graham <timograham@gmail.com>2016-01-05 09:37:11 -0500
commit186b6c61bfe85afa4d6bf213d04a28dd2853fed2 (patch)
treee068a17145cf17f4eaf887ecfc84d39ab150ced6 /django/utils/http.py
parentd5b90c8e120687863c1d41cf92a4cdb11413ad7f (diff)
Fixed #26024 -- Fixed regression in ConditionalGetMiddleware ETag support.
Thanks Denis Cornehl for help with the patch.
Diffstat (limited to 'django/utils/http.py')
-rw-r--r--django/utils/http.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/django/utils/http.py b/django/utils/http.py
index 3a3f665443..2dce7d3add 100644
--- a/django/utils/http.py
+++ b/django/utils/http.py
@@ -253,6 +253,13 @@ def quote_etag(etag):
return '"%s"' % etag.replace('\\', '\\\\').replace('"', '\\"')
+def unquote_etag(etag):
+ """
+ Unquote an ETag string; i.e. revert quote_etag().
+ """
+ return etag.strip('"').replace('\\"', '"').replace('\\\\', '\\') if etag else etag
+
+
def is_same_domain(host, pattern):
"""
Return ``True`` if the host is either an exact match or a match