This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author rschoon
Recipients pje, rschoon
Date 2014-07-01.03:15:09
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1404184510.5.0.84615415722.issue21890@psf.upfronthosting.co.za>
In-reply-to
Content
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()
History
Date User Action Args
2014-07-01 03:15:10rschoonsetrecipients: + rschoon, pje
2014-07-01 03:15:10rschoonsetmessageid: <1404184510.5.0.84615415722.issue21890@psf.upfronthosting.co.za>
2014-07-01 03:15:10rschoonlinkissue21890 messages
2014-07-01 03:15:09rschooncreate