• Vincent Pelletier's avatar
    ERP5Type/patches/WSGIPublisher: Emulate HTTPResponse.write better. · 68527217
    Vincent Pelletier authored
    Once a response has been written to, the status and headers are supposed
    to have been sent over the network. So any future change to them is moot.
    Likewise, setBody does nothing: only write can continue appending to the
    existing body.
    As in the case of WSGI the response does not actually get sent just yet:
    - lock the body
    - store finalize() result
    Also, make the order in which body and stdout are returned consistent with
    HTTPResponse: body is returned first (as part of HTTPResponse.write's call
    to self.outputBody, which calls self.__str__, which emits body), and then
    stdout content.
    Also, add support for cases whre the existing body is a file or an
    IUnboundStreamIterator.
    68527217
WSGIPublisher.py 17.2 KB