From e5a603787293f6deebe8f8e6c3782aea348e025d Mon Sep 17 00:00:00 2001 From: Igor Sobreira Date: Tue, 24 Jan 2012 23:48:54 -0200 Subject: [PATCH] Add test to parse_multipart_form_data() when invalid Content-Disposition --- tornado/test/httputil_test.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tornado/test/httputil_test.py b/tornado/test/httputil_test.py index b2d0d79b..2755c5b1 100644 --- a/tornado/test/httputil_test.py +++ b/tornado/test/httputil_test.py @@ -139,6 +139,19 @@ Foo parse_multipart_form_data(b("1234"), data, args, files) self.assertEqual(files, {}) + def test_invalid_content_disposition(self): + data = b('''\ +--1234 +Content-Disposition: invalid; name="files"; filename="ab.txt" + +Foo +--1234--''').replace(b("\n"), b("\r\n")) + args = {} + files = {} + parse_multipart_form_data(b("1234"), data, args, files) + self.assertEqual(files, {}) + + class HTTPHeadersTest(unittest.TestCase): def test_multi_line(self): # Lines beginning with whitespace are appended to the previous line