]> git.saurik.com Git - apt.git/blob - mirror-failure.py
make the server a little more robust against write errors (e.g. broken pipe)
[apt.git] / mirror-failure.py
1 # File: cgihttpserver-example-1.py
2
3 import CGIHTTPServer
4 import BaseHTTPServer
5
6 class Handler(CGIHTTPServer.CGIHTTPRequestHandler):
7 #cgi_directories = ["/cgi"]
8 def do_POST(self):
9 print "do_POST"
10 #print self.command
11 #print self.path
12 #print self.headers
13 print self.client_address
14 data = self.rfile.read(int(self.headers["content-length"]))
15 print data
16 self.wfile.write("200 Ok\n");
17
18 PORT = 8000
19
20 httpd = BaseHTTPServer.HTTPServer(("", PORT), Handler)
21 print "serving at port", PORT
22 httpd.serve_forever()
23