[Web-SIG] WSGI, cgi.FieldStorage incompatibility
Michael Kerrin
michael.kerrin at openapp.biz
Thu Oct 5 12:07:43 CEST 2006
Hi,
On Friday 29 September 2006 20:31, Guido van Rossum wrote:
> On 9/29/06, Michael Kerrin <michael.kerrin at openapp.biz> wrote:
> > 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
> >
> > Since it is reasonable for a WSGI application to use cgi.FieldStorage
> > I am wondering whether cgi.FieldStorage or the WSGI specification needs
> > to changed in order to solve this incompatibility.
> >
> > 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. 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.
>
> Since that change to cgi.py was a security fix I would strongly
> recommend not to remove it and to change the WSGI spec instead.
I wasn't recommending to remove that fix but instead I was trying get around
both problems by using the read method on the input stream instead of the
readline method. Since there are no problems passing the size argument to the
read method.
I think the best thing to do for now is to open a bug report on sourceforge.
Thanks
Michael
--
Michael Kerrin
55 Fitzwilliam Sq.,
Dublin 2.
Tel: 087 688 3894
More information about the Web-SIG
mailing list