[Web-SIG] environ["wsgi.input"].read()

Graham Dumpleton graham.dumpleton at gmail.com
Sun Jan 27 23:36:03 CET 2008


On 28/01/2008, Brian Smith <brian at briansmith.org> wrote:
> Manlio Perillo wrote:
> > Graham Dumpleton ha scritto:
> > > On 27/01/2008, Manlio Perillo <manlio_perillo at libero.it> wrote:
> > >> This is just a suggestion, but what about "requiring" that a WSGI
> > >> implementation calls the WSGI application only when all
> > >> the request body has been read?
> > >
> > > Can't do that. The input content could be dependent on partial
> > > response content which has already been returned by the WSGI
> > > application. Ie., something which streams in both ways.
> >
> > Can you make an example of this use case?
>
> PEP 333 allows the WSGI gateway to buffer the input if it chooses to do
> so: "The server or gateway may perform reads on-demand as requested by
> the application, or it may pre- read the client's request body and
> buffer it in-memory or on disk, or use any other technique for providing
> such an input stream, according to its preference."

But doing that sort of defeats the purpose of using chunked input and
would disallow use cases where delivery of the request content is
delivered in distinct blocks over an extended time but must be
consumed immediately and not when all is available. This is on top of
use case always mentioned whereby future request content may be
dependent in some way of response content already delivered back to
the client.

I know these are theoretical cases and people using these techniques
may be few and far between, but didn't want to be putting limitations
on things.

Graham


More information about the Web-SIG mailing list