[Web-SIG] WSGI, cgi.FieldStorage incompatibility
Guido van Rossum
guido at python.org
Fri Sep 29 21:31:55 CEST 2006
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
> 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.
--Guido van Rossum (home page: http://www.python.org/~guido/)
More information about the Web-SIG