[Web-SIG] Is the size argument to the input-stream read method optional?

Phillip J. Eby pje at telecommunity.com
Wed Dec 21 18:29:13 CET 2005

At 10:20 AM 12/21/2005 -0500, Jim Fulton wrote:
>Ian Bicking wrote:
> > Jim Fulton wrote:
> >
> >> The PEP is unclear on this and should be clarified, IMO.
> >
> >
> > My experience in using implementations is many servers do not require
> > the read size argument (they don't give a TypeError), but they block
> > without it, or if you read past CONTENT_LENGTH.  So it should probably
> > be required in the spec, since it's required in practice.
>Does this constitude a decision?  Can somebody update the PEP?

I thought the PEP was actually pretty clear on this already.  It says that 
the application should not attempt to read more data than is specified by 
CONTENT_LENGTH - which means that you can't omit the read() argument and 
avoid that.  An application that omits the argument is therefore off-spec, 
and a server is thus well within its rights to reject this.  As far as I 
know, there is also no circumstance under which a previously-working 
application (using CGI or some similar protocol) would be able to use 
read() without an argument and work correctly with any non-ancient version 
of HTTP.

I'm happy to entertain suggestions for language that would make this more 
obvious.  How about just adding """The "size" argument is required and must 
be a positive integer.""" to the existing note 1?

More information about the Web-SIG mailing list