(tctx: Context, keep_host_header: bool)
| 195 | |
| 196 | @pytest.mark.parametrize("keep_host_header", [True, False]) |
| 197 | def test_quic(tctx: Context, keep_host_header: bool): |
| 198 | with taddons.context(): |
| 199 | tctx.options.keep_host_header = keep_host_header |
| 200 | tctx.server.sni = "other.example.com" |
| 201 | tctx.client.proxy_mode = ProxyMode.parse("reverse:quic://example.org:443") |
| 202 | client_hello = Placeholder(bytes) |
| 203 | |
| 204 | def set_settings(data: quic.QuicTlsData): |
| 205 | data.settings = quic.QuicTlsSettings() |
| 206 | |
| 207 | assert ( |
| 208 | Playbook(modes.ReverseProxy(tctx)) |
| 209 | << OpenConnection(tctx.server) |
| 210 | >> reply(None) |
| 211 | >> DataReceived(tctx.client, b"\x00") |
| 212 | << NextLayerHook(Placeholder(NextLayer)) |
| 213 | >> reply_next_layer(layers.ServerQuicLayer) |
| 214 | << quic.QuicStartServerHook(Placeholder(quic.QuicTlsData)) |
| 215 | >> reply(side_effect=set_settings) |
| 216 | << SendData(tctx.server, client_hello) |
| 217 | << RequestWakeup(Placeholder(float)) |
| 218 | ) |
| 219 | assert tctx.server.address == ("example.org", 443) |
| 220 | assert quic.quic_parse_client_hello_from_datagrams([client_hello()]).sni == ( |
| 221 | "other.example.com" if keep_host_header else "example.org" |
| 222 | ) |
| 223 | |
| 224 | |
| 225 | def test_udp(tctx: Context): |
nothing calls this directly
no test coverage detected
searching dependent graphs…