[Tutor] Using CGIHTTPServer on Windows to run Perl & Python scripts - POST to Perl fails
python at venix.com
Sat Nov 12 02:40:46 CET 2005
The perl scripts use cgi.pm. The Python scripts use the cgi module.
Everything runs OK on Linux, where fork is available. On Windows the
run_cgi method uses os.popen3 to run the script and writes the post data
to the script's input file.
The Python scripts are OK. The Perl scripts do not receive the POST
parameters so they execute as though no parameters were supplied. I've
added logic to display the environment and that appears (to my Python
oriented eye) to be correct. In particular, the CONTENT_LENGTH and
CONTENT_TYPE are correct. GET requests work correctly.
In googling around, I found references to old POST problems under
Windows. Those have clearly been fixed. The Python scripts work and
the comments in the source code explain what was done (reading extra
characters beyond the specified content-length that IE pushes up to the
My guesses are that the Perl CGI module in Windows needs some other
environment cue to get it to read the input file or it expects a
different mechanism for receiving POST data than reading it from a file.
Any suggestions would be greatly appreciated.
(My fall back will be to change the run_cgi method for the Perl scripts
to mimic a GET and put the parameters into the environment QUERY_STRING
and hope that I do not exceed any limits on the string size.)
More information about the Tutor