Invalid Content-Length
values should be rejected #2014
Closed
Description
When cpp-httplib receives a request with an invalid Content-Length
header value, it treats it as equivalent to a value of 0 instead of rejecting the request with a 400.
For example, the following request should be rejected with status 400, but is instead accepted:
POST / HTTP/1.1\r\n
Host: whatever\r\n
Content-Length: x\r\n
\r\n
This is caused by the strtoull
call on httplib.h:2022
. The HTTP RFCs require stricter parsing than strtoull
enforces by default.