CGI POST problem was: How to read POSTed data

and-google at doxdesk.com and-google at doxdesk.com
Sat Feb 5 22:19:34 EST 2005


Dan Perl wrote:

> how is a multipart POST request parsed by CGIHTTPServer?

It isn't; the input stream containing the multipart/form-data content
is passed to the CGI script, which can choose to parse it or not using
any code it has to hand - which could be the 'cgi' module, but not
necessarily.

> Where is the parsing done for the POST data following the header?

If you are using the 'cgi' module, then cgi.parse_multipart.

> As a side note, I found other old reports of problems with cgi
> handling POST  requests, reports that don't seem to have had a
> resolution.

(in particular?)

FWIW, for interface-style and multipart-POST-file-upload-speed reasons
I wrote an alternative to cgi, form.py
(http://www.doxdesk.com/software/py/form.html). But I haven't found
cgi's POST reading to be buggy in general.

> There is even a bug reported just a few days ago (1112856) that is
> exactly about multipart post requests. If I understand the bug
> report correctly though, it is only on the latest version in CVS
> and it states that what is in the 2.4 release works.

That's correct.

> All this tells me that it could be a "fragile" part in the standard
> library.

I don't really think so; it's really an old stable part of the library
that is a bit crufty in places due to age. The patch that caused
1112856 was an attempt to rip out and replace the parser stuff, which
as a big change to old code is bound to cause trouble. But that's what
the dev cycle is for.

CGIHTTPServer, on the other hand, I have never really trusted. I would
suspect that fella.

-- 
Andrew Clover
mailto:and at doxdesk.com
http://www.doxdesk.com/




More information about the Python-list mailing list