MCPcopy
hub / github.com/mitmproxy/mitmproxy / h2_headers

Function h2_headers

test/mitmproxy/proxy/layers/http/test_http_fuzz.py:180–199  ·  view source on GitHub ↗
(draw)

Source from the content-addressed store, hash-verified

178
179@composite
180def h2_headers(draw):
181 required_headers = [
182 [":path", "/"],
183 [":scheme", draw(sampled_from(["http", "https"]))],
184 [":method", draw(sampled_from(["GET", "POST", "CONNECT"]))],
185 ]
186 optional_headers = [
187 [":authority", draw(sampled_from(["example.com:443", "example.com"]))],
188 ["cookie", "foobaz"],
189 ["host", "example.com"],
190 ["content-length", "42"],
191 ]
192 headers = required_headers + draw(lists(sampled_from(optional_headers), max_size=3))
193
194 i = draw(integers(0, len(headers)))
195 p = int(draw(booleans()))
196 r = draw(text())
197 if i > 0:
198 headers[i - 1][p - 1] = r
199 return headers
200
201
202@composite

Callers 1

h2_framesFunction · 0.85

Calls 2

drawFunction · 0.85
textFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…