[Web-SIG] [extension] x-wsgiorg.flush

Phillip J. Eby pje at telecommunity.com
Wed Oct 3 21:30:55 CEST 2007


At 04:57 PM 10/3/2007 +0200, Manlio Perillo wrote:
>A possibile solution can be to add an extension `x-wsgiorg.flush`, a
>callable object that notify the WSGI gateway that it can flush the
>headers (if they are not yet be sent) or the output buffer (Nginx has
>this feature, however I have yet not understand how it works).
>
>    start_response('200 Ok', [('Last-Modified', 'xxx')])
>
>    ...
>    environ['x-wsgiorg.flush']()
>
>    return a-generator
>
>
>The WSGI gateway can now send the headers before iterating over the
>generator, and if the client content is up-to-date, the new content is
>never generated.

Now that I understand what this is for, I can explain why a WSGI 
extension is not necessary to provide this feature.  In a compliant 
WSGI gateway, yielding an empty string from 'a-generator' is 
sufficient to "flush" the WSGI pipeline.

I suggest that you read this section of the spec more carefully:

http://www.python.org/dev/peps/pep-0333/#buffering-and-streaming



More information about the Web-SIG mailing list