-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Closed
Description
wsgi.py reads content_length string from environ['HTTP_CONTENT_LENGTH'] and never converts it into int.
Traceback (most recent call last):
File "/home/hguan/Desktop/raad/www/wsgi.py", line 34, in application
return tornado_application(environ, start_response)
File "/home/hguan/Desktop/raad/www/tornado/wsgi.py", line 77, in __call__
handler = web.Application.__call__(self, HTTPRequest(environ))
File "/home/hguan/Desktop/raad/www/tornado/wsgi.py", line 116, in __init__
self.headers["Content-Length"])
TypeError: an integer is required
Actually Content-Length is first read from environ['CONTENT_LENGTH'] and it gets converted into int. However, if HTTP_CONTENT_LENGTH also presents, it will overwrite self.header['Content-Length'] with a str.
if environ.get("CONTENT_LENGTH"):
self.headers["Content-Length"] = int(environ["CONTENT_LENGTH"])
for key in environ:
if key.startswith("HTTP_"):
self.headers[key[5:].replace("_", "-")] = environ[key]
if self.headers.get("Content-Length"):
self.body = environ["wsgi.input"].read(
self.headers["Content-Length"])
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels