[issue8077] cgi handling of POSTed files is broken
Pierre Quentel
report at bugs.python.org
Thu May 3 09:54:28 CEST 2012
Pierre Quentel <pierre.quentel at gmail.com> added the comment:
There are 2 different problems :
- handling of data by cgi.FieldStorage (issue 4953) : fixed since version 3.2
- in http.server.CGIHTTPRequestHandler, for POST requests on Windows, before opening the subprocess in run_cgi() all data is read by a *single* call to self.rfile.read(). If not all bytes are read by this single call, which is the case for a large file upload, only the read data are processed
The attached patch modifies http.server :
- if all data are read in the first call to self.rfile.read() (that is, if its length is equal to the Content-length header), process them
- if not, store all data in a temporary file (not in memory) and set the stdin argument of subprocess.Popen to this temporary file
With this patch, the tests provided by Mitchell all work on my PC (Windows XP Pro SP3)
----------
keywords: +patch
Added file: http://bugs.python.org/file25440/http-server.patch
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue8077>
_______________________________________
More information about the Python-bugs-list
mailing list