You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

24 lines
566 B

  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()