New submission from Robin Schoonover: Consider this paragraph of PEP3333, referring to headers obtained via start_response, emphasis mine:
Instead, it must store them for the server or gateway to transmit only after the first iteration of the application return value that yields a *non-empty bytestring*, or upon the application's first invocation of the write() callable. This means that an WSGI app such as this should be valid, because the yielded bytes pre-start_response are empty: def application(environ, start_response): yield b'' start_response("200 OK", [("Content-Type", "text/plain")]) yield b'Hello, World.\n' However, in wsgiref's simple server, this fails: Traceback (most recent call last): File "/usr/local/lib/python3.4/wsgiref/handlers.py", line 180, in finish_response self.write(data) File "/usr/local/lib/python3.4/wsgiref/handlers.py", line 269, in write raise AssertionError("write() before start_response()") AssertionError: write() before start_response() ---------- components: Library (Lib) messages: 222005 nosy: pje, rschoon priority: normal severity: normal status: open title: wsgiref.simple_server doesn't accept empty bytes before start_response is called type: behavior _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue21890> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com