mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-23 08:11:00 +00:00
pathod: add ALPN support
This commit is contained in:
parent
2c423eded1
commit
6be6595425
@ -39,21 +39,23 @@ class SSLOptions:
|
|||||||
request_client_cert=False,
|
request_client_cert=False,
|
||||||
sslversion=tcp.SSLv23_METHOD,
|
sslversion=tcp.SSLv23_METHOD,
|
||||||
ciphers=None,
|
ciphers=None,
|
||||||
certs=None
|
certs=None,
|
||||||
|
alpn_select=None,
|
||||||
):
|
):
|
||||||
self.confdir = confdir
|
self.confdir = confdir
|
||||||
self.cn = cn
|
self.cn = cn
|
||||||
|
self.sans = sans
|
||||||
|
self.not_after_connect = not_after_connect
|
||||||
|
self.request_client_cert = request_client_cert
|
||||||
|
self.sslversion = sslversion
|
||||||
|
self.ciphers = ciphers
|
||||||
|
self.alpn_select = alpn_select
|
||||||
self.certstore = certutils.CertStore.from_store(
|
self.certstore = certutils.CertStore.from_store(
|
||||||
os.path.expanduser(confdir),
|
os.path.expanduser(confdir),
|
||||||
CERTSTORE_BASENAME
|
CERTSTORE_BASENAME
|
||||||
)
|
)
|
||||||
for i in certs or []:
|
for i in certs or []:
|
||||||
self.certstore.add_cert_file(*i)
|
self.certstore.add_cert_file(*i)
|
||||||
self.not_after_connect = not_after_connect
|
|
||||||
self.request_client_cert = request_client_cert
|
|
||||||
self.ciphers = ciphers
|
|
||||||
self.sslversion = sslversion
|
|
||||||
self.sans = sans
|
|
||||||
|
|
||||||
def get_cert(self, name):
|
def get_cert(self, name):
|
||||||
if self.cn:
|
if self.cn:
|
||||||
@ -173,6 +175,7 @@ class PathodHandler(tcp.BaseHandler):
|
|||||||
request_client_cert=self.server.ssloptions.request_client_cert,
|
request_client_cert=self.server.ssloptions.request_client_cert,
|
||||||
cipher_list=self.server.ssloptions.ciphers,
|
cipher_list=self.server.ssloptions.ciphers,
|
||||||
method=self.server.ssloptions.sslversion,
|
method=self.server.ssloptions.sslversion,
|
||||||
|
alpn_select=self.server.ssloptions.alpn_select,
|
||||||
)
|
)
|
||||||
except tcp.NetLibError as v:
|
except tcp.NetLibError as v:
|
||||||
s = str(v)
|
s = str(v)
|
||||||
@ -340,6 +343,7 @@ class PathodHandler(tcp.BaseHandler):
|
|||||||
request_client_cert=self.server.ssloptions.request_client_cert,
|
request_client_cert=self.server.ssloptions.request_client_cert,
|
||||||
cipher_list=self.server.ssloptions.ciphers,
|
cipher_list=self.server.ssloptions.ciphers,
|
||||||
method=self.server.ssloptions.sslversion,
|
method=self.server.ssloptions.sslversion,
|
||||||
|
alpn_select=self.server.ssloptions.alpn_select,
|
||||||
)
|
)
|
||||||
except tcp.NetLibError as v:
|
except tcp.NetLibError as v:
|
||||||
s = str(v)
|
s = str(v)
|
||||||
@ -502,7 +506,8 @@ def main(args): # pragma: nocover
|
|||||||
ciphers = args.ciphers,
|
ciphers = args.ciphers,
|
||||||
sslversion = utils.SSLVERSIONS[args.sslversion],
|
sslversion = utils.SSLVERSIONS[args.sslversion],
|
||||||
certs = args.ssl_certs,
|
certs = args.ssl_certs,
|
||||||
sans = args.sans
|
sans = args.sans,
|
||||||
|
alpn_select = args.alpn_select,
|
||||||
)
|
)
|
||||||
|
|
||||||
root = logging.getLogger()
|
root = logging.getLogger()
|
||||||
|
Loading…
Reference in New Issue
Block a user