Author mkerrin
Recipients
Date 2006-10-09.18:34:30
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
The WSGI specification says in the section on "Input
and Error Streams":

  The optional "size" argument to readline() is not
supported, as it may be complex for server authors to
implement, and is not often used in practice.

  But the current implementation of cgi.FieldStorage in
the 2.4.4 branch and on Python 2.5 does call readline
with the size argument. It has started to do this in
response to the Python bug #1112549 - cgi.FieldStorage
memory usage can spike in line-oriented ops. See 
http://sourceforge.net/tracker/index.php?func=detail&aid=1112549&group_id=5470&atid=105470
 
  I am not 100% sure wheather this is a bug in the WSGI
application or cgi.FieldStorage class,

  Originally I thought it was cgi.FieldStorage that
needs to be changed, and hence tried to fix it by
wrapping the input stream so that the readline method
always uses the read method on the input stream (so has
to not to break the above mentioned bug). While this
seems to work for me it introduces a level of
complexity in the cgi.py file, and possible some other
bugs, that makes me think that adding the size argument
for readline into the WSGI specification isn't such bad
idea after all.

  I have attached my patch against cgi.FieldStorage if
any one thinks this is the best way of fixing this issue.

  This is an issue for Zope3 has Zope3 doesn't support
the size argument and neither does Twisted from which
Zope gets its input stream.
History
Date User Action Args
2007-08-23 14:43:39adminlinkissue1573931 messages
2007-08-23 14:43:39admincreate