mirror-failure.py 566 B

123456789101112131415161718192021222324
  1. # File: cgihttpserver-example-1.py
  2. import CGIHTTPServer
  3. import BaseHTTPServer
  4. class Handler(CGIHTTPServer.CGIHTTPRequestHandler):
  5. #cgi_directories = ["/cgi"]
  6. def do_POST(self):
  7. print "do_POST"
  8. #print self.command
  9. #print self.path
  10. #print self.headers
  11. print self.client_address
  12. data = self.rfile.read(int(self.headers["content-length"]))
  13. print data
  14. self.wfile.write("200 Ok\n");
  15. PORT = 8000
  16. httpd = BaseHTTPServer.HTTPServer(("", PORT), Handler)
  17. print "serving at port", PORT
  18. httpd.serve_forever()