Is anyone using CGIHTTPServer on a non-Unix/Windows platform?

Kevin Altis altis at semi-retired.com
Mon Jun 18 17:24:38 EDT 2001


You might want to read two bug posts I've made to sourceforge
https://sourceforge.net/tracker/?func=detail&aid=430160&group_id=5470&atid=1
05470
I think this is the issue you are seeing.

https://sourceforge.net/tracker/?func=detail&aid=427345&group_id=5470&atid=1
05470
This one will take care of the binary issue.

ka

"Mark Wright" <mwright at pro-ns.net> wrote in message
news:f9ff3f62.0106181252.5a048fa1 at posting.google.com...
> I'm having problems getting it to work.  I'm running python CGI
> scripts using the execfile() part of CGIHTTPServer (i.e. !has_fork and
> !has_popen2), and it works like a charm when I do a GET.  But when I
> try to do a POST, the thing just hangs in telnet and I get the "Page
> could not be displayed" error in IE and a blank page in Mozilla.
>
> (Techinically, I am running on Windows, but I've commented out the
> popen2() section due to text/binary file conversion issues.)
>
> Is anyone else having this problem?  The following script is an
> example of one that fails (but works fine in Apache):
>
> import os
> import sys
> import cgi
>
> # ----------------------------------------------------------------------
> if __name__ == '__main__':
>
> # parse parameters
> form = cgi.FieldStorage()
>
> out_file = sys.stdout
> if os.environ['REQUEST_METHOD'] == 'POST':
> out_file.write('Content-Type: text/html\n\n')
> out_file.write("<html>\n")
> out_file.write("<head><title> Did this work? </title></head>\n")
> out_file.write("<body>\n")
> # keys = os.environ.keys()
> # keys.sort()
> # for key in keys:
> # out_file.write("<br>" + key + ':' + cgi.escape(os.environ[key]) +
> \
> # '\n')
> out_file.write("Did this work?\n")
> out_file.write("</body></html>\n")
>
> else:
> out_file.write('Content-type: text/html\n\n')
> out_file.write("<html>\n")
> out_file.write("<head><title> Did this work? </title></head>\n")
> out_file.write("<body>\n")
> out_file.write(
> """<form action="xyz.py" method="POST">
> <br> try this out
> <input type="submit" name="BtnTest" value="Test">
> </form>""")
> out_file.write("</body></html>\n")





More information about the Python-list mailing list