import SimpleHTTPServer import SocketServer import os import sys import signal
def quit(signal_num,frame): print("you stop the threading") sys.exit()
path = os.path.dirname(sys.argv[0])
os.chdir('/home/cephuse/output/')
class ReusingTCPServer(SimpleHTTPServer.SimpleHTTPRequestHandler): allow_reuse_address = True
def send_head(self): # horrible kludge because SimpleHTTPServer is buggy wrt # slash-redirecting of requests with query arguments, and will # redirect to /foo?q=bar/ -- wrong slash placement self.path = self.path.split('?', 1)[0] return SimpleHTTPServer.SimpleHTTPRequestHandler.send_head(self)