Improve compliance with RFC 9112 for status line parsing#298
Conversation
This patch improves compliance with RFC 9112 Section 4 for parsing the
status-line of the HTTP response.
- Require the HTTP version to be in the format "HTTP/x.y"
- Disallow cases like "http/1.1" (lowercase "http"), "HTTP" (missing
version), "HTTP/10.23" (multidigit versions)
- Require a space between the status-code and the reason-phrase, even
when the reason-phrase is empty
- Disallow cases like "HTTP/1.1 200" (missing space after status code)
- Make clear that SP parsing operates on the lenient behavior, which
allows 'HTAB, VT (%x0B), FF (%x0C), or bare CR' in addition to space
1965596 to
b9212e4
Compare
|
Regarding the lenient behavior on parsing SP: I personally don't think we need to keep this. OpenJDK java.net.http, Go net/http, undici all only accept single whitespaces, indicating status lines like Reference (RFC 9112 Section 4):
|
This patch improves compliance with RFC 9112 Section 4 for parsing the status-line of the HTTP response.
https://datatracker.ietf.org/doc/html/rfc9112#name-status-line