[Web-SIG] Emulating req.write() in WSGI

Graham Dumpleton graham.dumpleton at gmail.com
Wed Jun 30 02:13:00 CEST 2010

On 29 June 2010 23:37, Aaron Fransen <aaron.fransen at gmail.com> wrote:
> Fortunately we're not talking about a huge amount of data here, basically
> just a couple of notices to keep the user happy (less than 1K usually).
> When using yield, it's as if the module where the yield command is run is
> completely ignored. The page returned is a "default" page generated by the
> application. Errors are being trapped, but none are being generated, it's
> just exiting without any kind of notice.
> When using write() without a Content-Length header, nothing shows on the
> browser.
> When using write() with a Content-Length header, the first update shows (and
> only after the entire page has been generated), but none of the subsequent
> ones nor the final page.
> When using write() with a Content-Length header set large enough to
> encompass the entire final result, the final result page shows, but none of
> the informational messages leading up to the generation of the page appear.

These statements concerns me.

The Content-Length header if you are sending a response of unknown
length should not be set. Further, you definitely cannot return/write
more response data than is specified by Content-Length. Doing so
breaks HTTP and mod_wsgi will actually deliberately discard anything
returned over what Content-Length specifies.

Can you clarify this? Are you setting Content-Length to a value less
than the amount of data you could actually return?


More information about the Web-SIG mailing list