(caplog_async, monkeypatch)
| 846 | |
| 847 | @pytest.mark.skip("HTTP/3 for regular mode is not fully supported yet") |
| 848 | async def test_regular_http3(caplog_async, monkeypatch) -> None: |
| 849 | caplog_async.set_level("INFO") |
| 850 | ps = Proxyserver() |
| 851 | nl = NextLayer() |
| 852 | ta = TlsConfig() |
| 853 | with taddons.context(ps, nl, ta) as tctx: |
| 854 | ta.configure(["confdir"]) |
| 855 | async with quic_server(H3EchoServer, alpn=["h3"]) as server_addr: |
| 856 | orig_open_connection = mitmproxy_rs.udp.open_udp_connection |
| 857 | |
| 858 | async def open_connection_path( |
| 859 | host: str, port: int, *args, **kwargs |
| 860 | ) -> mitmproxy_rs.Stream: |
| 861 | if host == "example.mitmproxy.org" and port == 443: |
| 862 | host = server_addr[0] |
| 863 | port = server_addr[1] |
| 864 | return orig_open_connection(host, port, *args, **kwargs) |
| 865 | |
| 866 | monkeypatch.setattr( |
| 867 | mitmproxy_rs.udp, "open_udp_connection", open_connection_path |
| 868 | ) |
| 869 | mode = f"http3@127.0.0.1:0" |
| 870 | tctx.configure( |
| 871 | ta, |
| 872 | ssl_verify_upstream_trusted_ca=tlsdata.path( |
| 873 | "../net/data/verificationcerts/trusted-root.crt" |
| 874 | ), |
| 875 | ) |
| 876 | tctx.configure(ps, mode=[mode]) |
| 877 | assert await ps.setup_servers() |
| 878 | ps.running() |
| 879 | await caplog_async.await_log(f"HTTP3 proxy listening") |
| 880 | assert ps.servers |
| 881 | addr = ps.servers[mode].listen_addrs[0] |
| 882 | async with quic_connect(H3Client, alpn=["h3"], address=addr) as client: |
| 883 | await _test_echo(client=client, strict=True) |
| 884 | assert len(ps.connections) == 1 |
| 885 | |
| 886 | tctx.configure(ps, server=False) |
| 887 | await caplog_async.await_log("stopped") |
| 888 | await _wait_for_connection_closes(ps) |
nothing calls this directly
no test coverage detected
searching dependent graphs…