-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Invalid Content-Length
values should be rejected
#2014
Comments
@kenballus thanks for the report.
Where can we see the information? |
From RFC 9112:
RFC 9110 gives the following ABNF rule for
|
If you want to use You also need to check the beginning of the value to make sure that |
@kenballus thanks for the detailed helpful informaiton! |
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:
This is caused by the
strtoull
call onhttplib.h:2022
. The HTTP RFCs require stricter parsing thanstrtoull
enforces by default.The text was updated successfully, but these errors were encountered: