MCPcopy Create free account
hub / github.com/mitmproxy/mitmproxy / test_invalid_header

Function test_invalid_header

test/mitmproxy/proxy/layers/http/test_http3.py:406–434  ·  view source on GitHub ↗
(tctx: context.Context)

Source from the content-addressed store, hash-verified

404
405
406def test_invalid_header(tctx: context.Context):
407 playbook, cff = start_h3_proxy(tctx)
408 assert (
409 playbook
410 >> cff.receive_headers(
411 [
412 (b":method", b"CONNECT"),
413 (b":path", b"/"),
414 (b":authority", b"example.com"),
415 ],
416 end_stream=True,
417 )
418 << cff.send_decoder() # for receive_headers
419 << quic.CloseQuicConnection(
420 tctx.client,
421 error_code=ErrorCode.H3_GENERAL_PROTOCOL_ERROR.value,
422 frame_type=None,
423 reason_phrase="Invalid HTTP/3 request headers: Required pseudo header is missing: b':scheme'",
424 )
425 # ensure that once we close, we don't process messages anymore
426 >> cff.receive_headers(
427 [
428 (b":method", b"CONNECT"),
429 (b":path", b"/"),
430 (b":authority", b"example.com"),
431 ],
432 end_stream=True,
433 )
434 )
435
436
437def test_simple(tctx: context.Context):

Callers

nothing calls this directly

Calls 3

start_h3_proxyFunction · 0.85
receive_headersMethod · 0.80
send_decoderMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…