net/textproto: fails to trim header value
dvyukov opened this issue · comments
Dmitry Vyukov commented
The following program:
package main
import (
"bufio"
"bytes"
"fmt"
"net/http"
)
func main() {
data := []byte("GET / HTTP/0.0\nh:\n 0 \n\n")
r, err := http.ReadRequest(bufio.NewReader(bytes.NewReader(data)))
if err != nil {
return
}
fmt.Printf("%q\n", r.Header.Get("h"))
}
prints:
"0 "
Header values must be trimmed.
go version devel +a1fe3b5 Sat Jun 13 04:33:26 2015 +0000 linux/amd64
GopherBot commented
CL https://golang.org/cl/15683 mentions this issue.