CGI POST problem was: How to read POSTed data
Dan Perl
danperl at rogers.com
Sun Feb 6 12:19:21 EST 2005
<and-google at doxdesk.com> wrote in message
news:1107659974.048175.221770 at z14g2000cwz.googlegroups.com...
> Dan Perl wrote:
>
>> how is a multipart POST request parsed by CGIHTTPServer?
> [...]
> CGIHTTPServer, on the other hand, I have never really trusted. I would
> suspect that fella.
It turns out I was wrong thinking that the POST requests I was handling were
multipart. Blame that on my limited knowledge of HTTP. At least the
content-type header in the request doesn't say that they are multipart. I
checked with the an Ethereal sniffer and my Firefox browser on Windows sends
a request with 'content-type: application/x-www-form-urlencoded' and the
form data in the body of the request, after the headers. I'll assume for
now that this is a valid HTTP POST request as I believe that Firefox is
responsible for it alone and that it is not determined by my HTML form.
Pierre Quentel's suggestion for an implementation of do_POST in the "How to
read POSTed data" seems to handle requests of this kind, although I didn't
personally try it. But the run_cgi method in CGIHTTPServer expects the form
data to be only in the POST header line, in the path of the URL, like in a
GET request. I cannot find form data being parsed any other way if the
content-type is x-www-form-urlencoded. Am I missing something? Also, I
don't know if this means anything, but shouldn't CGIHTTPServer use the cgi
module if cgi has all those useful parsing utilities?
Dan
More information about the Python-list
mailing list