From: Igor Sobreira Date: Wed, 25 Jan 2012 00:45:18 +0000 (-0200) Subject: Add test to parse_multipart_form_data() on httputil when "boundary" parameter has... X-Git-Tag: v2.3.0~105^2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=554570d658b91b717a2a0bd5ea52ad77535268f0;p=thirdparty%2Ftornado.git Add test to parse_multipart_form_data() on httputil when "boundary" parameter has quotes --- diff --git a/tornado/test/httputil_test.py b/tornado/test/httputil_test.py index 0566b6e0e..f5d7a1aed 100644 --- a/tornado/test/httputil_test.py +++ b/tornado/test/httputil_test.py @@ -114,6 +114,21 @@ Foo self.assertEqual(file["filename"], filename) self.assertEqual(file["body"], b("Foo")) + def test_boundary_starts_and_ends_with_quotes(self): + data = b('''\ +--1234 +Content-Disposition: form-data; name="files"; filename="ab.txt" + +Foo +--1234--''').replace(b("\n"), b("\r\n")) + args = {} + files = {} + parse_multipart_form_data(b('"1234"'), data, args, files) + file = files["files"][0] + self.assertEqual(file["filename"], "ab.txt") + self.assertEqual(file["body"], b("Foo")) + + class HTTPHeadersTest(unittest.TestCase): def test_multi_line(self): # Lines beginning with whitespace are appended to the previous line