mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-30 03:14:22 +00:00
raise error if --http2 is specified, but the OpenSSL version doesn't support it
This commit is contained in:
parent
218e66cb32
commit
c8d2876f23
@ -363,6 +363,11 @@ def proxy_options(parser):
|
||||
help="Proxy service port."
|
||||
)
|
||||
http2 = group.add_mutually_exclusive_group()
|
||||
# !!!
|
||||
# Watch out: We raise a RuntimeError in libmproxy.proxy.config if http2 is enabled,
|
||||
# but the OpenSSL version does not have ALPN support (which is the default on Ubuntu 14.04).
|
||||
# Do not simply set --http2 as enabled by default.
|
||||
# !!!
|
||||
http2.add_argument("--http2", action="store_true", dest="http2")
|
||||
http2.add_argument("--no-http2", action="store_false", dest="http2",
|
||||
help="Explicitly enable/disable experimental HTTP2 support. "
|
||||
|
@ -180,6 +180,9 @@ def process_proxy_options(parser, options):
|
||||
parser.error("Certificate file does not exist: %s" % parts[1])
|
||||
certs.append(parts)
|
||||
|
||||
if options.http2 and not tcp.HAS_ALPN:
|
||||
raise RuntimeError("HTTP2 support requires OpenSSL 1.0.2 or above.")
|
||||
|
||||
return ProxyConfig(
|
||||
host=options.addr,
|
||||
port=options.port,
|
||||
|
Loading…
Reference in New Issue
Block a user