CGIHTTPServer, revisited

Fred Pacquier fredp at mygale.org.nospam
Fri Apr 12 12:32:10 EDT 2002


Well, seeing there was little in response to my previous post ("Baffled by 
CGI cross-browser issues"), I went back to what I should have started with 
: doing my homework on Google Groups. And what do you know, I'm not alone : 
there's been over a hundred _threads_ on this topic just in the past two 
years.

I read through quite a few of them, and although there was a lot of 
information to be found, I didn't feel there was a definitive answer to the 
question : is CGIHTTPServer somewhat broken under Win9x, even in Python 
2.2? Some say it _does_ work, others it _should_ work, but many seem to be 
stuck just like me.

I've tried a few of the hints found here and there : running scripts with 
'python -u', hacking CGIHTTPServer.py to remove 'fork' and 'popen' 
detection, forcing it to run scripts 'in-process'... Although I'm still 
wondering what Tim Peters-ly-meant by 'having w9xpopen.exe in all the right 
places' :-)

Right now, after upgrading to 2.2.1, I'm still left with the following 
unsatisfactory result : under Win98SE the very minimal script below (and 
its many variants) work fine in Gecko-based browsers (Mozilla, K-meleon), 
always generates a "Network error - connection reset by peer" in Netscape 
4.x (with subsequent output sometimes truncated), and always fails totally 
on submit in MSIE 5.0 and 5.5 at least (server not found etc.).

I'd really like to understand how/why this happens. Can't be just a 
browser-side issue, can it ?...

#-----------------------------
# test.py
import cgi   
form = cgi.FieldStorage()
s=''
for name in form.keys():
    s = s + "Input: " + name + " --> " + form[name].value + "<p>\n"

print """
<head><title>Test form</title></head><body>
<FORM METHOD=POST action="/cgi-bin/test.py">
<INPUT TYPE=text NAME=spam>
<br>
<INPUT TYPE=RADIO NAME="page_type" VALUE="front" CHECKED>Front
<INPUT TYPE=RADIO NAME="page_type" VALUE="back">Back
<br>
<input type=submit name="sub_go" value="Go">
<p>
%s
</body></html>
""" % s
#-----------------------------

-- 
YAFAP : http://www.multimania.com/fredp/



More information about the Python-list mailing list