From 0bed5fae277c06435594fdbe09f7b75791fdc311 Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Tue, 28 Feb 2012 11:37:48 +1300 Subject: [PATCH] Rationalise upstream cert flag and variable names. --- libmproxy/cmdline.py | 6 +++--- libmproxy/proxy.py | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/libmproxy/cmdline.py b/libmproxy/cmdline.py index 42c024494..ffd1826a2 100644 --- a/libmproxy/cmdline.py +++ b/libmproxy/cmdline.py @@ -147,9 +147,9 @@ def common_options(parser): help="Wait for specified number of seconds after a new cert is generated. This can smooth over small discrepancies between the client and server times." ) parser.add_option( - "--upstream-cn-lookup", default=False, - action="store_true", dest="upstream_cn_lookup", - help="Connect to upstream server to look up certificate Common Name." + "--upstream-cert", default=False, + action="store_true", dest="upstream_cert", + help="Connect to upstream server to look up certificate details." ) group = optparse.OptionGroup(parser, "Client Replay") diff --git a/libmproxy/proxy.py b/libmproxy/proxy.py index ec7c52e43..b626e9435 100644 --- a/libmproxy/proxy.py +++ b/libmproxy/proxy.py @@ -35,13 +35,13 @@ class ProxyError(Exception): class ProxyConfig: - def __init__(self, certfile = None, ciphers = None, cacert = None, cert_wait_time=0, upstream_cn_lookup=False, body_size_limit = None, reverse_proxy=None): + def __init__(self, certfile = None, ciphers = None, cacert = None, cert_wait_time=0, upstream_cert=False, body_size_limit = None, reverse_proxy=None): self.certfile = certfile self.ciphers = ciphers self.cacert = cacert self.certdir = None self.cert_wait_time = cert_wait_time - self.upstream_cn_lookup = upstream_cn_lookup + self.upstream_cert = upstream_cert self.body_size_limit = body_size_limit self.reverse_proxy = reverse_proxy @@ -349,7 +349,7 @@ class ProxyHandler(SocketServer.StreamRequestHandler): return self.config.certfile else: sans = [] - if self.config.upstream_cn_lookup: + if self.config.upstream_cert: host, sans = utils.get_remote_cn(host, port) ret = utils.dummy_cert(self.config.certdir, self.config.cacert, host, sans) time.sleep(self.config.cert_wait_time) @@ -542,6 +542,6 @@ def process_proxy_options(parser, options): ciphers = options.ciphers, cert_wait_time = options.cert_wait_time, body_size_limit = body_size_limit, - upstream_cn_lookup = options.upstream_cn_lookup, + upstream_cert = options.upstream_cert, reverse_proxy = rp )