-
Notifications
You must be signed in to change notification settings - Fork 267
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add error handling for Content-Length header
Return HTTP 400 if Content-Length header is invalid. The Content-Length header is defined to be an integer 0 or greater. See RFC 9110 Section 8.6. Content-Length. Return HTTP 411 if Content-Length is empty for POST, if Transfer-Encoding is not set. If however Transfer-Encoding is used for POST, Content-Length is ignored. See RFC 9112 Section 6.1 Transfer-Encoding. This improves the previous behaviour when Content-Length is not an integer where Yaws immediately cut the connection. It is not totally clearly defined what to do when Content-Length is invalid, but responding with HTTP 400 Bad Request at least notifies the user of their error. One implementation detail to note is that all headers needs to be collected in order to know if Transfer-Encoding is set, if it is set Content-Lenght is ignored. However, if Transfer-Encoding is not set, the normal error handling for Content-Length is performed. This means that the report of multiple content-length headers error is deferred to when all headers are collected..
- Loading branch information
Showing
3 changed files
with
199 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters