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

Graham Dumpleton graham.dumpleton at gmail.com
Wed Jun 30 02:17:38 CEST 2010


On 30 June 2010 02:14, Aaron Fransen <aaron.fransen at gmail.com> wrote:
> Couple more things I've been able to discern.
>
> The first happened after I "fixed" the html code. Originally under
> mod_python, I guess I was cheating more than a little bit by sending
> <html></html> code blocks twice, once for the incremental notices, once for
> the final content. Once I changed the code to send a single properly parsed
> block, the entire document showed up as expected, however it still did not
> send any part of the html incrementally.
>
> Watching the line with Wireshark, all of the data was transmitted at the
> same time, so nothing was sent to the browser incrementally.
>
> (This is using the write() functionality, I haven't tried watching the line
> with yield yet.)

Use a variation of WSGI middleware wrapper in:

  http://code.google.com/p/modwsgi/wiki/DebuggingTechniques#Tracking_Request_and_Response

using it to 'print' returned data to Apache log and then tail Apache
error log to see when that data is output. Alternatively, change the
code there to output a time stamp against each chunk of data written
to the file recording the response content.

This will show what data is returned by WSGI application, before
mod_wsgi truncates anything greater than content length specified,
plus also show whether it is your WSGI application which is delaying
output somehow, or whether Apache output filters are doing it.

Graham


More information about the Web-SIG mailing list