New submission from Robin Schoonover: In the reference WSGI server in wsgiref.simple_server, wsgi.input's readline() hangs if the request body does not actually contain any newlines.
Consider the following (slightly silly) example: from wsgiref.simple_server import make_server def app(environ, start_response): result = environ['wsgi.input'].readline() # not reached... start_response("200 OK", [("Content-Type", "text/plain")]) return [] httpd = make_server('', 8000, app) httpd.serve_forever() And the following also silly request (the data kwarg makes it a POST request): from urllib.request import urlopen req = urlopen("http://localhost:8000/", data=b'some bytes') print(req) Normally this isn't a problem, as the reference server isn't intended for production, and typically the only reason .readline() would be used is with a request body formatted as multipart/form-data, which uses ample newlines, including with the content boundaries. However, for other types of request bodies (such as application/x-www-form-urlencoded) newlines often wouldn't appear, and using .readline() would wait forever for new input. ---------- components: Library (Lib) messages: 221774 nosy: rschoon priority: normal severity: normal status: open title: wsgi.simple_server's wsgi.input readline waits forever for non-multipart/form-data type: behavior _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue21878> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com