How to read POSTed data
Dan Perl
danperl at rogers.com
Sun Feb 6 23:38:31 EST 2005
"Dan Perl" <danperl at rogers.com> wrote in message
news:HcydnfD3to45MZvfRVn-iQ at rogers.com...
> Thanks, Pierre, this got me much further but I hit another stumbling
> block. I can see now that CGIHTTPServer writes all the header lines into
> os.environ and creates a subprocess for the script with os.popen2 or
> os.popen3 (it's Windows), passing the form data to the new process through
> sys.stdin (I believe it is sys.stdin although the Library Reference
> descriptions of popen2 and popen3 say that would be sys.stdout). But I
> don't see any of those headers updated in the os.environ of the cgi
> script's process. Is the parent's os.environ passed to the subprocesses
> created with popen2/popen3 on Windows?
>
> cgi.FieldStorage.read_urlencoded needs the content-length that should be
> passed through os.environ.
I was about to report a bug but then I found bug report "[ 1100235 ] Scripts
started with CGIHTTPServer: missing cgi environment" which is actually
caused by "[ 1110478 ] os.environ.update doesn't work". They are fixed with
a patch in 1110478. I still have to try it. I do like the alternate
solution proposed by the originator of 1100235 though. I also thought that
CGIHTTPServer should use the new subprocess.Popen class instead of popen2,
popen3 and popen4.
More information about the Python-list
mailing list