From 4fc807cedd9a481db9e0fc1633d8c169f53f4a8e Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Sun, 20 Feb 2011 12:12:55 +1300 Subject: Clean up certificate generation. - Use templates for config files. We can re-introduce customization of the certificate attributes when we need them. - Split CA and cert generation into separate functions. - Generation methods provide an error return when generation fails. - When the user explicitly specifies a certificate, we don't generate it, but fail if it doesn't exist. --- libmproxy/proxy.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'libmproxy/proxy.py') diff --git a/libmproxy/proxy.py b/libmproxy/proxy.py index 4ab19694..e3c692b9 100644 --- a/libmproxy/proxy.py +++ b/libmproxy/proxy.py @@ -550,7 +550,7 @@ class ProxyHandler(SocketServer.StreamRequestHandler): if config.certpath is not None: cert = config.certpath + "/" + host + ".pem" if not os.path.exists(cert) and config.cacert is not None: - utils.make_bogus_cert(cert, ca=config.cacert, commonName=host) + utils.dummy_cert(config.certpath, config.cacert, host) if os.path.exists(cert): return cert print >> sys.stderr, "WARNING: Certificate missing for %s:%d! (%s)\n" % (host, port, cert) @@ -679,9 +679,9 @@ class ProxyServer(ServerBase): def set_mqueue(self, q): self.masterq = q - def process_request(self, request, client_address): - return ServerBase.process_request(self, request, client_address) - def finish_request(self, request, client_address): self.RequestHandlerClass(request, client_address, self, self.masterq) + def shutdown(self): + ServerBase.shutdown(self) + -- cgit v1.2.3