[Web-SIG] wsgiref.validate allows wsgi.input.read() with no argument
graham.dumpleton at gmail.com
Fri Dec 12 23:52:09 CET 2008
2008/12/13 Ian Bicking <ianb at colorstudy.com>:
> Graham Dumpleton wrote:
>> Just noticed that although WSGI PEP doesn't specifically mention that
>> argument to read() on wsgi.input is optional, wsgiref.validate allows
>> calling read() with no argument.
>>> From wsgiref.validate:
>> * That wsgi.input is used properly:
>> - .read() is called with zero or one argument
>> class InputWrapper:
>> def read(self, *args):
>> assert_(len(args) <= 1)
>> v = self.input.read(*args)
>> assert_(type(v) is type(""))
>> return v
>> Of course, the issue is still that WSGI PEP says:
>> """The server is not required to read past the client's specified
>> Content-Length, and ***is allowed to simulate an end-of-file condition
>> if the application attempts to read past that point***."""
> An application that relies on the server to simulate end-of-file will be a
> broken application on some servers. This is not an uncommon problem.
> Therefore the validator tests for this case; if you want an application
> that actually works consistently, you shouldn't do
The validator does not test for that case, that is what I am pointing
out. The validator allows read() to be called with no argument.
More information about the Web-SIG