Skip to content

Commit

Permalink
switch to stock aioquic (mitmproxy#6573)
Browse files Browse the repository at this point in the history
  • Loading branch information
mhils committed Jan 1, 2024
1 parent 8918984 commit 95c5bf9
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 11 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Expand Up @@ -31,7 +31,7 @@ classifiers = [
# https://packaging.python.org/en/latest/discussions/install-requires-vs-requirements/#install-requires
# It is not considered best practice to use install_requires to pin dependencies to specific versions.
dependencies = [
"aioquic_mitmproxy>=0.9.21,<0.10",
"aioquic>=0.9.24,<0.10",
"asgiref>=3.2.10,<3.8",
"Brotli>=1.0,<1.2",
"certifi>=2019.9.11", # no semver here - this should always be on the last release!
Expand Down
8 changes: 4 additions & 4 deletions test/mitmproxy/proxy/layers/test_modes.py
Expand Up @@ -196,8 +196,8 @@ def test_reverse_dns(tctx):
def test_quic(tctx: Context, keep_host_header: bool):
with taddons.context():
tctx.options.keep_host_header = keep_host_header
tctx.server.sni = "other"
tctx.client.proxy_mode = ProxyMode.parse("reverse:quic://1.2.3.4:5")
tctx.server.sni = "other.example.com"
tctx.client.proxy_mode = ProxyMode.parse("reverse:quic://example.org:443")
client_hello = Placeholder(bytes)

def set_settings(data: quic.QuicTlsData):
Expand All @@ -215,9 +215,9 @@ def set_settings(data: quic.QuicTlsData):
<< SendData(tctx.server, client_hello)
<< RequestWakeup(Placeholder(float))
)
assert tctx.server.address == ("1.2.3.4", 5)
assert tctx.server.address == ("example.org", 443)
assert quic.quic_parse_client_hello(client_hello()).sni == (
"other" if keep_host_header else "1.2.3.4"
"other.example.com" if keep_host_header else "example.org"
)


Expand Down
17 changes: 11 additions & 6 deletions test/mitmproxy/proxy/layers/test_quic.py
Expand Up @@ -840,20 +840,23 @@ def test_untrusted_cert(self, tctx: context.Context):
playbook
>> events.Wakeup(playbook.actual[9])
<< commands.Log(
"Server QUIC handshake failed. Certificate does not match hostname 'wrong.host.mitmproxy.org'",
tutils.StrMatching(
"Server QUIC handshake failed. hostname 'wrong.host.mitmproxy.org' doesn't match"
),
WARNING,
)
<< tls.TlsFailedServerHook(tls_hook_data)
>> tutils.reply()
<< commands.CloseConnection(tctx.server)
<< commands.SendData(
tctx.client,
b"open-connection failed: Certificate does not match hostname 'wrong.host.mitmproxy.org'",
tutils.BytesMatching(
b"open-connection failed: hostname 'wrong.host.mitmproxy.org' doesn't match"
),
)
)
assert (
tls_hook_data().conn.error
== "Certificate does not match hostname 'wrong.host.mitmproxy.org'"
assert tls_hook_data().conn.error.startswith(
"hostname 'wrong.host.mitmproxy.org' doesn't match"
)
assert not tctx.server.tls_established

Expand Down Expand Up @@ -1133,7 +1136,9 @@ def test_mitmproxy_ca_is_untrusted(self, tctx: context.Context):
playbook
>> events.Wakeup(playbook.actual[7])
<< commands.Log(
"Client QUIC handshake failed. Certificate does not match hostname 'wrong.host.mitmproxy.org'",
tutils.StrMatching(
"Client QUIC handshake failed. hostname 'wrong.host.mitmproxy.org' doesn't match"
),
WARNING,
)
<< tls.TlsFailedClientHook(tls_hook_data)
Expand Down

0 comments on commit 95c5bf9

Please sign in to comment.