mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2025-02-01 15:55:28 +00:00
http2: fix bugs, chrome works 🎉
This commit is contained in:
parent
605af2d3d4
commit
778644d4b8
@ -279,7 +279,7 @@ class HttpLayer(Layer):
|
|||||||
if isinstance(e, ProtocolException):
|
if isinstance(e, ProtocolException):
|
||||||
raise e
|
raise e
|
||||||
else:
|
else:
|
||||||
raise ProtocolException(repr(e), e)
|
raise ProtocolException("Error in HTTP connection: %s" % repr(e), e)
|
||||||
finally:
|
finally:
|
||||||
flow.live = False
|
flow.live = False
|
||||||
|
|
||||||
|
@ -153,7 +153,7 @@ class TlsLayer(Layer):
|
|||||||
alpn_select_callback=self.__alpn_select_callback,
|
alpn_select_callback=self.__alpn_select_callback,
|
||||||
)
|
)
|
||||||
except tcp.NetLibError as e:
|
except tcp.NetLibError as e:
|
||||||
raise ProtocolException(repr(e), e)
|
raise ProtocolException("Cannot establish TLS with client: %s" % repr(e), e)
|
||||||
|
|
||||||
def _establish_tls_with_server(self):
|
def _establish_tls_with_server(self):
|
||||||
self.log("Establish TLS with server", "debug")
|
self.log("Establish TLS with server", "debug")
|
||||||
@ -189,9 +189,9 @@ class TlsLayer(Layer):
|
|||||||
(tls_cert_err['depth'], tls_cert_err['errno']),
|
(tls_cert_err['depth'], tls_cert_err['errno']),
|
||||||
"error")
|
"error")
|
||||||
self.log("Aborting connection attempt", "error")
|
self.log("Aborting connection attempt", "error")
|
||||||
raise ProtocolException(repr(e), e)
|
raise ProtocolException("Cannot establish TLS with server: %s" % repr(e), e)
|
||||||
except tcp.NetLibError as e:
|
except tcp.NetLibError as e:
|
||||||
raise ProtocolException(repr(e), e)
|
raise ProtocolException("Cannot establish TLS with server: %s" % repr(e), e)
|
||||||
|
|
||||||
self.log("ALPN selected by server: %s" % self.alpn_for_client_connection, "debug")
|
self.log("ALPN selected by server: %s" % self.alpn_for_client_connection, "debug")
|
||||||
|
|
||||||
|
@ -14,6 +14,9 @@ TRANSPARENT_SSL_PORTS = [443, 8443]
|
|||||||
CONF_BASENAME = "mitmproxy"
|
CONF_BASENAME = "mitmproxy"
|
||||||
CA_DIR = "~/.mitmproxy"
|
CA_DIR = "~/.mitmproxy"
|
||||||
|
|
||||||
|
# We manually need to specify this, otherwise OpenSSL may select a non-HTTP2 cipher by default.
|
||||||
|
# https://mozilla.github.io/server-side-tls/ssl-config-generator/?server=apache-2.2.15&openssl=1.0.2&hsts=yes&profile=old
|
||||||
|
DEFAULT_CLIENT_CIPHERS = "ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:ECDHE-RSA-DES-CBC3-SHA:ECDHE-ECDSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:DES-CBC3-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA"
|
||||||
|
|
||||||
class HostMatcher(object):
|
class HostMatcher(object):
|
||||||
def __init__(self, patterns=[]):
|
def __init__(self, patterns=[]):
|
||||||
@ -241,7 +244,7 @@ def ssl_option_group(parser):
|
|||||||
'Can be passed multiple times.')
|
'Can be passed multiple times.')
|
||||||
group.add_argument(
|
group.add_argument(
|
||||||
"--ciphers-client", action="store",
|
"--ciphers-client", action="store",
|
||||||
type=str, dest="ciphers_client", default=None,
|
type=str, dest="ciphers_client", default=DEFAULT_CLIENT_CIPHERS,
|
||||||
help="Set supported ciphers for client connections. (OpenSSL Syntax)"
|
help="Set supported ciphers for client connections. (OpenSSL Syntax)"
|
||||||
)
|
)
|
||||||
group.add_argument(
|
group.add_argument(
|
||||||
|
Loading…
Reference in New Issue
Block a user