CGI POST problem was: How to read POSTed data

Dan Perl danperl at rogers.com
Sat Feb 5 17:15:52 EST 2005


I am piggybacking on Hakan's original posting because I am addressing the 
same group of people (those with good knowledge in the standard web 
programming modules), on a related topic.  However, my question is 
independent of Hakan's.

I have trouble getting a simple CGI script to work because it gets an empty 
cgi.FieldStorage form.  I have looked into and tried to debug the internals 
of the standard modules that are used but I cannot figure it out: how is a 
multipart POST request parsed by CGIHTTPServer?  BTW, I am using pyton 2.4.

I found the parsing of the header in the rfc822 module used by 
BaseHTTPServer.BaseHTTPRequestHandler (through the mimetools module), but 
that stops after the header (at the first empty line).  Where is the parsing 
done for the POST data following the header?  I will appreciate any pointers 
that will help me debug this problem.

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.  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.  All this tells me that it could be a "fragile" part in the standard 
library.  So it could be even a bug in the standard library, but for now I 
am assuming that I'm doing something wrong.

Thanks,

Dan 





More information about the Python-list mailing list