mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-27 02:24:18 +00:00
Rationalise upstream cert flag and variable names.
This commit is contained in:
parent
a03e1af7e7
commit
0bed5fae27
@ -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."
|
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(
|
parser.add_option(
|
||||||
"--upstream-cn-lookup", default=False,
|
"--upstream-cert", default=False,
|
||||||
action="store_true", dest="upstream_cn_lookup",
|
action="store_true", dest="upstream_cert",
|
||||||
help="Connect to upstream server to look up certificate Common Name."
|
help="Connect to upstream server to look up certificate details."
|
||||||
)
|
)
|
||||||
|
|
||||||
group = optparse.OptionGroup(parser, "Client Replay")
|
group = optparse.OptionGroup(parser, "Client Replay")
|
||||||
|
@ -35,13 +35,13 @@ class ProxyError(Exception):
|
|||||||
|
|
||||||
|
|
||||||
class ProxyConfig:
|
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.certfile = certfile
|
||||||
self.ciphers = ciphers
|
self.ciphers = ciphers
|
||||||
self.cacert = cacert
|
self.cacert = cacert
|
||||||
self.certdir = None
|
self.certdir = None
|
||||||
self.cert_wait_time = cert_wait_time
|
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.body_size_limit = body_size_limit
|
||||||
self.reverse_proxy = reverse_proxy
|
self.reverse_proxy = reverse_proxy
|
||||||
|
|
||||||
@ -349,7 +349,7 @@ class ProxyHandler(SocketServer.StreamRequestHandler):
|
|||||||
return self.config.certfile
|
return self.config.certfile
|
||||||
else:
|
else:
|
||||||
sans = []
|
sans = []
|
||||||
if self.config.upstream_cn_lookup:
|
if self.config.upstream_cert:
|
||||||
host, sans = utils.get_remote_cn(host, port)
|
host, sans = utils.get_remote_cn(host, port)
|
||||||
ret = utils.dummy_cert(self.config.certdir, self.config.cacert, host, sans)
|
ret = utils.dummy_cert(self.config.certdir, self.config.cacert, host, sans)
|
||||||
time.sleep(self.config.cert_wait_time)
|
time.sleep(self.config.cert_wait_time)
|
||||||
@ -542,6 +542,6 @@ def process_proxy_options(parser, options):
|
|||||||
ciphers = options.ciphers,
|
ciphers = options.ciphers,
|
||||||
cert_wait_time = options.cert_wait_time,
|
cert_wait_time = options.cert_wait_time,
|
||||||
body_size_limit = body_size_limit,
|
body_size_limit = body_size_limit,
|
||||||
upstream_cn_lookup = options.upstream_cn_lookup,
|
upstream_cert = options.upstream_cert,
|
||||||
reverse_proxy = rp
|
reverse_proxy = rp
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user