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

Phillip J. Eby pje at telecommunity.com
Wed Oct 3 18:52:57 CEST 2007

Thinking about this made me realize that WSGI 2.0 isn't going to be 
able to validate *anything* about a response by raising an error in 
the application, because everything is done after the code returns.

That suggests to me that these sorts of errors should be handled by 
changing the response sent to the browser, instead.  That is, sending 
an internal error message to the browser and logging details of the problem.

At 04:57 PM 10/3/2007 +0200, Manlio Perillo wrote:
>Nginx, in one of the headers filters, can do ETag and Last-Modified
>I want to be able to use this feature, so I don't have to use thirdy
>party solutions.
>However with the current WSGI implementation this is not possible.
>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.
>The intent of this extension is to be transparent to the WSGI application.
>In case of nginx mod_wsgi, the validation can be done by Nginx, but for
>generic WSGI applications this can be done by a middleware.
>I don't know if this feature is feasible, since I have not yet
>implemented it, so I would like to receive some feedbacks.
>Thanks  Manlio Perillo
>Web-SIG mailing list
>Web-SIG at python.org
>Web SIG: http://www.python.org/sigs/web-sig

More information about the Web-SIG mailing list