summaryrefslogtreecommitdiff
path: root/tests/httpwrappers/tests.py
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2015-02-18 10:09:33 +0100
committerClaude Paroz <claude@2xlibre.net>2015-02-19 20:18:31 +0100
commitefb1f99f943b99624c78b91ff58502125490191e (patch)
tree60cb56cf81aff9cd12185b9e95ea1cf3930d2ef6 /tests/httpwrappers/tests.py
parentceadc94f09f0615e95146f9a42b711acfc14f40f (diff)
downloaddjango-efb1f99f943b99624c78b91ff58502125490191e.tar.gz
Fixed #20889 -- Prevented BadHeaderError when Python inserts newline
Workaround for http://bugs.python.org/issue20747. In some corner cases, Python 2 inserts a newline in a header value despite `maxlinelen` passed in Header constructor. Thanks Tim Graham for the review.
Diffstat (limited to 'tests/httpwrappers/tests.py')
-rw-r--r--tests/httpwrappers/tests.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/tests/httpwrappers/tests.py b/tests/httpwrappers/tests.py
index da371dc74b..25da7b622c 100644
--- a/tests/httpwrappers/tests.py
+++ b/tests/httpwrappers/tests.py
@@ -306,6 +306,9 @@ class HttpResponseTests(unittest.TestCase):
f = 'zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz a\xcc\x88'.encode('latin-1')
f = f.decode('utf-8')
h['Content-Disposition'] = 'attachment; filename="%s"' % f
+ # This one is triggering http://bugs.python.org/issue20747, that is Python
+ # will itself insert a newline in the header
+ h['Content-Disposition'] = 'attachement; filename="EdelRot_Blu\u0308te (3)-0.JPG"'
def test_newlines_in_headers(self):
# Bug #10188: Do not allow newlines in headers (CR or LF)