raise error if --http2 is specified, but the OpenSSL version doesn't support it

This commit is contained in:
Maximilian Hils 2016-02-08 00:44:38 +01:00
parent 218e66cb32
commit c8d2876f23
2 changed files with 8 additions and 0 deletions

View File

@ -363,6 +363,11 @@ def proxy_options(parser):
help="Proxy service port." help="Proxy service port."
) )
http2 = group.add_mutually_exclusive_group() 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("--http2", action="store_true", dest="http2")
http2.add_argument("--no-http2", action="store_false", dest="http2", http2.add_argument("--no-http2", action="store_false", dest="http2",
help="Explicitly enable/disable experimental HTTP2 support. " help="Explicitly enable/disable experimental HTTP2 support. "

View File

@ -180,6 +180,9 @@ def process_proxy_options(parser, options):
parser.error("Certificate file does not exist: %s" % parts[1]) parser.error("Certificate file does not exist: %s" % parts[1])
certs.append(parts) certs.append(parts)
if options.http2 and not tcp.HAS_ALPN:
raise RuntimeError("HTTP2 support requires OpenSSL 1.0.2 or above.")
return ProxyConfig( return ProxyConfig(
host=options.addr, host=options.addr,
port=options.port, port=options.port,