From: Ben Darnell Date: Tue, 24 May 2011 06:23:39 +0000 (-0700) Subject: Inner headers for multipart/form-data default to utf-8 X-Git-Tag: v2.0.0~62 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ca2be3e99e863cc1395d23cbe5f660ecb5bf4815;p=thirdparty%2Ftornado.git Inner headers for multipart/form-data default to utf-8 --- diff --git a/tornado/httpserver.py b/tornado/httpserver.py index 2cadee13f..344ed29fd 100644 --- a/tornado/httpserver.py +++ b/tornado/httpserver.py @@ -432,7 +432,7 @@ class HTTPConnection(object): if eoh == -1: logging.warning("multipart/form-data missing headers") continue - headers = httputil.HTTPHeaders.parse(part[:eoh].decode("latin1")) + headers = httputil.HTTPHeaders.parse(part[:eoh].decode("utf-8")) name_header = headers.get("Content-Disposition", "") if not name_header.startswith("form-data;") or \ not part.endswith(b("\r\n")): diff --git a/tornado/test/httpserver_test.py b/tornado/test/httpserver_test.py index 5bc7007a6..eb0bbfdea 100644 --- a/tornado/test/httpserver_test.py +++ b/tornado/test/httpserver_test.py @@ -123,7 +123,7 @@ class HTTPConnectionTest(AsyncHTTPTestCase, LogTrapTestCase): b(""), u"\u00e1".encode("utf-8"), b("--1234567890"), - u'Content-Disposition: form-data; name="files"; filename="\u00f3"'.encode("latin1"), + u'Content-Disposition: form-data; name="files"; filename="\u00f3"'.encode("utf8"), b(""), u"\u00fa".encode("utf-8"), b("--1234567890"),