HTTP Location: supported by HTTPServer?

  • Thread starter Will Stuyvesant
  • Start date
W

Will Stuyvesant

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()
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top