Description
Go version
go1.23.4
Output of go env
in your module/workspace:
https://cs.opensource.google/go/go/+/refs/tags/go1.23.4:src/net/http/server.go;l=2058
What did you do?
My web server lies atop Go's *net/http.Server
. When fiddling with a new endpoint, I had a truly baffling cURL session:
$ curl jfrech.com -H "x:y$(echo -e '\r\n')"
400 Bad Request$
(Note the missing newline before the final $
.)
Somehow, a shell variable in my session must have gotten infected with a trailing CRLF which cURL seems to blindly stick into its request (I would have expected cURL to error or sanitize it away; or even (try to) encode the CRLF.)
What did you see happen?
Even stranger, no logs whatsoever where written server-side and my cURL request felt like it was never experienced by my web server. A strangely missing newline was the cherry on top.
What did you expect to see?
I think https://cs.opensource.google/go/go/+/refs/tags/go1.23.4:src/net/http/server.go;l=2058 [2024-12-11] is missing a final CRLF.
Cursorily glancing at the surrounding code, the addition of a trailing CRLF also wouldn't hurt the four preceding fmt.Fprintf
lines.