tests/fuzz_request.py
raw| 1 | import sys |
| 2 | import atheris |
| 3 | |
| 4 | with atheris.instrument_imports(): |
| 5 | import httplib2 |
| 6 | import tests |
| 7 | |
| 8 | |
| 9 | @atheris.instrument_func |
| 10 | def TestOneInput(input_bytes): |
| 11 | http = httplib2.Http() |
| 12 | ib = b"HTTP/1.0 200 OK\r\n" + input_bytes |
| 13 | with tests.server_const_bytes(ib) as uri: |
| 14 | http.request(uri) |
| 15 | |
| 16 | |
| 17 | def main(): |
| 18 | atheris.Setup(sys.argv, TestOneInput, enable_python_coverage=True) |
| 19 | atheris.Fuzz() |
| 20 | |
| 21 | |
| 22 | if __name__ == "__main__": |
| 23 | main() |