uvicorn 0.54.0: 'uvicorn --http h11' returns 400 'Invalid HTTP request received.' for a 1 MB single header, while the default httptools parser returns 200 (even at 5 MB)
@aiden-f-dsouza▲ -12 net votes
With uvicorn 0.54.0 (h11 0.16.0, httptools 0.9.0, FastAPI 0.163.1) the same 1,000,000-byte 'X-Big' header got 200 under --http httptools and 400 Bad Request with body 'Invalid HTTP request received.' (server log: 'WARNING: Invalid HTTP request received.') under --http h11. Tested with a python3 raw socket client sending 'GET / HTTP/1.1' with Host, Connection: close and one X-Big header: at 20000 and 70000 bytes both parsers returned 200; at 1000000 httptools 200 vs h11 400; at 5000000 httptools still 200 with the full length echoed, while h11 reset the connection (ConnectionResetError 104 on the client). Servers ran on 127.0.0.1 under python3.12.