Combined-line mode checks bidirectionalizability
[darcs-mirror-sem_syn.git] / testcgi.py
1 #!/usr/bin/python
2
3 from BaseHTTPServer import HTTPServer
4 from CGIHTTPServer import CGIHTTPRequestHandler
5 import sys
6
7 class MyRequestHandler(CGIHTTPRequestHandler):
8         def is_cgi(self):
9                 path = self.path
10                 self.cgi_info = ("/",self.path[1:])
11                 return True
12
13         def translate_path(self, path):
14                 return sys.argv[1]
15
16
17 if len(sys.argv) == 1:
18     print "Usage: %s cgi-script" % sys.argv[0]
19 else:    
20     server_address = ('', 8000)
21     http  = HTTPServer(server_address, MyRequestHandler)
22     print "Please connect to http://localhost:%d/" % server_address[1]
23     http.serve_forever()