Created
October 11, 2011 10:06
-
-
Save soundkitchen/1277749 to your computer and use it in GitHub Desktop.
CGIHTTPServer を / でも動くように野良化してみた。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# vim: fileencoding=utf-8 : | |
from CGIHTTPServer import test, CGIHTTPRequestHandler as BaseRequestHandler | |
class CGIHTTPRequestHandler(BaseRequestHandler): | |
def is_cgi(self): | |
path = self.path | |
if path.endswith('.py'): | |
try: | |
i = path.rindex('/') | |
self.cgi_info = path[:i], path[i+1:] | |
except ValueError, e: | |
self.cgi_info = '', path | |
return True | |
return False | |
def main(): | |
test(CGIHTTPRequestHandler) | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment