Fixed encoding bug in HTTP request processing, causing weird flask issues
If a content type header was present on a multipart form data part it would turn the rewritten body into a unicode instead of a byte array, causing a later conversion to a byte stream to not capture. Fixed both the fact that the rewritten body would turn into unicode by making sure the content type header was provided as byte array and fixed the byte stream conversion to also trigger on unicode instances. Solves #1531
This commit is contained in:
parent
a161feb106
commit
39d5446789
1 changed files with 2 additions and 2 deletions
|
|
@ -361,7 +361,7 @@ class UploadStorageFallbackHandler(tornado.web.RequestHandler):
|
|||
file=handle)
|
||||
|
||||
else:
|
||||
return dict(name=tornado.escape.utf8(name), content_type=content_type, data=b"")
|
||||
return dict(name=tornado.escape.utf8(name), content_type=tornado.escape.utf8(content_type), data=b"")
|
||||
|
||||
def _on_part_data(self, part, data):
|
||||
"""
|
||||
|
|
@ -598,7 +598,7 @@ class WsgiInputContainer(object):
|
|||
|
||||
# determine the request_body to supply as wsgi.input
|
||||
if body is not None:
|
||||
if isinstance(body, (bytes, str)):
|
||||
if isinstance(body, (bytes, str, unicode)):
|
||||
request_body = io.BytesIO(tornado.escape.utf8(body))
|
||||
else:
|
||||
request_body = body
|
||||
|
|
|
|||
Loading…
Reference in a new issue