-
Notifications
You must be signed in to change notification settings - Fork 104
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
Content-Lenth and Content-Type in bodyless message #2341
base: master
Are you sure you want to change the base?
Conversation
https://github.com/tempesta-tech/tempesta-test/pull/769/fileshere is the test branch |
3ea6f8b
to
36012f3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
# | ||
# Example: | ||
# http_allow_empty_body_content_type true; | ||
# |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please also describe this in wiki? Also with good story from #2322 and #2341 (comment) : make examples for the implementations, cite the RFC and how to we violate it (e.g. with Content-Length: 0
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
36012f3
to
5424941
Compare
RFC 9110 8.6: A server MUST NOT send a Content-Length header field in any response with a status code of 1xx (Informational) or 204 (No Content). Now for responses 1xx and 204 Tempesta FW treats `Content-Length: 0` as the absence of a Content-Length header. Some implementations send `Content-Length: 0` within 204 (No Content) response, to be able to process such messages the rule from RFC 9110 8.6 has been relaxed. For requests with bodyless methods such as HEAD, GET, etc. Tempesta also treats `Content-Length: 0` as empty body and considers such requests as valid. Added directive `http_allow_empty_body_content_type` that allows Tempesta FW to process requests with bodyless methods. By default Tempesta FW drops such requests.
Now `content-length: 0` is allowed with bodyless methods, in the tests `content-length: 0` changed to `content-length: 1`. However we don't send body, because it's unnecessary, because we expect that validation of bodyless method will block request before body will be parsed.
5424941
to
6adad8b
Compare
RFC 9110 8.6:
A server MUST NOT send a Content-Length header field in any response with a status code of 1xx (Informational) or 204 (No Content).
Now for responses 1xx and 204 Tempesta FW treats
Content-Length: 0
as the absence of a Content-Length header. Some implementations sendContent-Length: 0
within 204 (No Content) response, to be able to process such messages the rule from RFC 9110 8.6 has been relaxed.For requests with bodyless methods such as HEAD, GET, etc. Tempesta also treats
Content-Length: 0
as empty body and considers such requests as valid.Added directive
http_allow_empty_body_content_type
that allows Tempesta FW to process requests with bodyless methods. By default Tempesta FW drops such requests.