Closed erikdubbelboer closed 5 months ago
This patch looks good, but it could be improved by rejecting more characters than just \t
, \r
, and
.
The RFCs define header names with the following grammar rules:
field-name = token
token = 1*tchar
tchar = "!" / "#" / "$" / "%" / "&" / "'" / "*" / "+" / "-" / "." / "^" / "_" / "`" / "|" / "~" / DIGIT / ALPHA
Thus, all of the following characters should also be prohibited in field-names, in addition to \r
, `, and
\t`:
\x00
-\x08
inclusive,\x0b
,\x0c
,\x0e
-\x1f
inclusive,"
,(
,)
,,
,/
,;
,<
,=
,>
,?
,@
,[
,\
,]
,{
,}
,\x7f
-\xff
inclusivenet/http
errors on all of these characters.
Good point, I have no changed it to check all characters.
From RFC 9112:
net/http seems to completely error on this, so let's do the same.
Fixes https://github.com/valyala/fasthttp/issues/1785
See: https://go.dev/play/p/EmMgzC_yLvN