HTTP Location: supported by HTTPServer?
Will Stuyvesant
hwlgw at hotmail.com
Thu Dec 4 12:34:39 EST 2003
More information about the Python-list mailing list
Thu Dec 4 12:34:39 EST 2003
- Previous message (by thread): Python Embedding in C++
- Next message (by thread): ISO to Gregorian, strptime madness
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
I have a CGI server written in Python, useful for offline CGI testing. One of my CGI scripts ends with: print 'Location: http://myresourcelocation' print But this does not work with the Python CGI server...and the same script *does* work via internet with the Apache server at my work. Does the BaseHTTPServer.HTTPServer not support the HTTP Location header or something like that? >From my Python CGI server program: PORT = 8000 class Handler(CGIHTTPServer.CGIHTTPRequestHandler): ## # Put subdirectories BEFORE their parent directories or else HTTP # error 403 (no permission). cgi_directories = ["/cgi-bin/mystuff", "/cgi-bin"] ## # A hack for quiet mode: don't want messages (what IP reads what # URL) to the console box def log_message(self, *msg): pass def serve(): httpd = BaseHTTPServer.HTTPServer(("", PORT), Handler) print "serving at port", PORT httpd.serve_forever() class CGIServer(threading.Thread): def run(self): serve() if __name__=='__main__': CGIServer().start()
- Previous message (by thread): Python Embedding in C++
- Next message (by thread): ISO to Gregorian, strptime madness
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list