Beispiel #1
0
 def do_GET(self):
     print "do_GET : %s"%self.path
     url=urlparse.urlparse(self.path)
     file_path = os.getcwd() + "" + url[2]
     
     if (os.path.isfile(file_path)):
         '''If the file exist in the doc root so return the content'''
         try:
             with open(file_path) as f:
                 self.wfile.write(f.read())
         except IOError:
             self.send_error(500, 'Internal server error')
     else :
         HTTPRequestHandler.do_GET(self)
Beispiel #2
0
 def __init__(self, request, client_address, server):
         HTTPRequestHandler.__init__(self, request, client_address, server)