diff --git a/libmproxy/cmdline.py b/libmproxy/cmdline.py index 111ab145b..d8b6000cb 100644 --- a/libmproxy/cmdline.py +++ b/libmproxy/cmdline.py @@ -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. " diff --git a/libmproxy/proxy/config.py b/libmproxy/proxy/config.py index bf765d810..a635ab19e 100644 --- a/libmproxy/proxy/config.py +++ b/libmproxy/proxy/config.py @@ -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,