summaryrefslogtreecommitdiff
path: root/tests/httpwrappers
diff options
context:
space:
mode:
authorDaniel Boeve <djboeve@gmail.com>2013-09-06 18:47:08 +0000
committerTim Graham <timograham@gmail.com>2013-09-09 08:47:41 -0400
commit6dca603abb0eb164ba87657caf5cc65bca449719 (patch)
tree19ddd94d5224a472c0c85ed4f26aeca65722c103 /tests/httpwrappers
parentaeed2cf3b23161f228c8b221e56ea4d8a7cf71aa (diff)
Fixed #20889 -- Prevented email.Header from inserting newlines
Passed large maxlinelen to email.Header to prevent newlines from being inserted into value returned by _convert_to_charset Thanks mjl at laubach.at for the report.
Diffstat (limited to 'tests/httpwrappers')
-rw-r--r--tests/httpwrappers/tests.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/httpwrappers/tests.py b/tests/httpwrappers/tests.py
index 356818d2ef..0d9611ef0e 100644
--- a/tests/httpwrappers/tests.py
+++ b/tests/httpwrappers/tests.py
@@ -290,6 +290,13 @@ class HttpResponseTests(unittest.TestCase):
self.assertRaises(UnicodeError, r.__setitem__, 'føø', 'bar')
self.assertRaises(UnicodeError, r.__setitem__, 'føø'.encode('utf-8'), 'bar')
+ def test_long_line(self):
+ # Bug #20889: long lines trigger newlines to be added to headers
+ # (which is not allowed due to bug #10188)
+ h = HttpResponse()
+ f = 'zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz a\xcc\x88'.encode('latin-1')
+ f = f.decode('utf-8')
+ h['Content-Disposition'] = u'attachment; filename="%s"' % f
def test_newlines_in_headers(self):
# Bug #10188: Do not allow newlines in headers (CR or LF)