class WebServer(SocketServer.ThreadingMixIn,BaseHTTPServer.HTTPServer):
# Works with basehttphandler
do_get(self):
if 'home' in self.path:
<do something here>
# "Working" Method is commented out. The problem I'm having is being unable to
# handle requests like GET, POST, etc with CGIHTTPRequestHandler.:
#
#DoIT=BaseHTTPServer.BaseHTTPRequestHandler((SERVER_ADDRESS,PORT),WebServer)
DoIt=webserver((SERVER_ADDRESS,PORT),CGIHTTPServer.CGIHTTPRequestHandler)
DoIT.serve_forever()
这适用于 basehttprequesthandler,而不适用于 cgihttprequesthandler。如果可行的话,我需要一种方法来管理请求的两种“类型”(使用两个库?)。提前致谢。