Stop serving arbitrary files. Content type, post body.

This commit is contained in:
Ian Gulliver
2016-04-04 22:44:13 -07:00
parent 80e24b01cd
commit 38f35d423f
2 changed files with 14 additions and 2 deletions

View File

@@ -43,7 +43,16 @@ class HTTPServer6(server.HTTPServer):
class CertServer(object):
def __init__(self, listen_host, listen_port, server_key, server_cert, ca_cert):
self._httpd = HTTPServer6((listen_host, listen_port), server.SimpleHTTPRequestHandler)
class RequestHandler(server.BaseHTTPRequestHandler):
def do_POST(self):
assert self.headers['Content-Type'] == 'application/x-pem-file'
size = int(self.headers['Content-Length'])
print(self.rfile.read(size))
self.send_response(200)
self.end_headers()
self._httpd = HTTPServer6((listen_host, listen_port), RequestHandler)
self._httpd.socket = ssl.wrap_socket(
self._httpd.socket,
keyfile=server_key,