Message6538

Author jeff250
Recipients jeff250
Date 2011-06-03.01:26:06
SpamBayes Score 9.222511e-10
Marked as misclassified No
Message-id <1307064366.84.0.619159935704.issue1754@psf.upfronthosting.co.za>
In-reply-to
Content
By thinly wrapping a Java InputStream for wsgi.input, the wsgi.input's file.read(size) method can unblock and return "early."  Java's InputStream.read() is allowed to return less than the requested # of bytes under non-exceptional/EOF conditions, whereas wsgi.input requires the file.read() method to block until the requested # of bytes are available (except for exceptional/EOF conditions).

From https://code.djangoproject.com/ticket/13756:
----------
PEP 3333 says that wsgi.input is:
> An input stream (file-like object) from which the HTTP request body
> bytes can be read. (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.)

It adds that:

> The semantics of each method are as documented in the Python Library
> Reference

In the Python Library Reference, the semantic of [file-like object].read() is:
> Read at most size bytes from the file (less if the read hits EOF
> before obtaining size bytes).

This means that:
  * WSGI does require a wsgi.input file object that blocks on reads until a buffer of exactly the requested length is returned, or EOF / Content-Length is reached,
  * the bug is in modjy, which does not provide an appropriate file-like object right now.
----------
History
Date User Action Args
2011-06-03 01:26:06jeff250setrecipients: + jeff250
2011-06-03 01:26:06jeff250setmessageid: <1307064366.84.0.619159935704.issue1754@psf.upfronthosting.co.za>
2011-06-03 01:26:06jeff250linkissue1754 messages
2011-06-03 01:26:06jeff250create