MCPcopy Index your code
hub / github.com/python-websockets/websockets / test_one_input

Function test_one_input

fuzzing/fuzz_http11_response_parser.py:12–35  ·  view source on GitHub ↗
(data)

Source from the content-addressed store, hash-verified

10
11
12def test_one_input(data):
13 reader = StreamReader()
14 reader.feed_data(data)
15 reader.feed_eof()
16
17 parser = Response.parse(
18 reader.read_line,
19 reader.read_exact,
20 reader.read_to_eof,
21 )
22 try:
23 next(parser)
24 except StopIteration as exc:
25 assert isinstance(exc.value, Response)
26 return # input accepted
27 except (
28 EOFError, # connection is closed without a full HTTP response
29 SecurityError, # response exceeds a security limit
30 LookupError, # response isn't well formatted
31 ValueError, # response isn't well formatted
32 ):
33 return # input rejected with a documented exception
34
35 raise RuntimeError("parsing didn't complete")
36
37
38def main():

Callers

nothing calls this directly

Calls 4

feed_dataMethod · 0.95
feed_eofMethod · 0.95
StreamReaderClass · 0.90
parseMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…