mirror of
https://github.com/golang/go
synced 2024-09-25 11:20:13 -06:00
net/http/httputil: fix spelling of Trailer hop-by-hop header per errata
RFC Errata 4522 (http://www.rfc-editor.org/errata_search.php?eid=4522) notes that RFC 2616 had a typo in a list of headers that the httputil.ReverseProxy code copied. Fix the typo in our code. Fixes #14174 Change-Id: Ifc8f18fd58a6508a02a23e54ff3c473f03e521d3 Reviewed-on: https://go-review.googlesource.com/19133 Reviewed-by: Russ Cox <rsc@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
eb5bfa7171
commit
2639498f9b
@ -109,8 +109,8 @@ var hopHeaders = []string{
|
||||
"Keep-Alive",
|
||||
"Proxy-Authenticate",
|
||||
"Proxy-Authorization",
|
||||
"Te", // canonicalized version of "TE"
|
||||
"Trailers",
|
||||
"Te", // canonicalized version of "TE"
|
||||
"Trailer", // not Trailers per URL above; http://www.rfc-editor.org/errata_search.php?eid=4522
|
||||
"Transfer-Encoding",
|
||||
"Upgrade",
|
||||
}
|
||||
|
@ -48,6 +48,7 @@ func TestReverseProxy(t *testing.T) {
|
||||
if g, e := r.Host, "some-name"; g != e {
|
||||
t.Errorf("backend got Host header %q, want %q", g, e)
|
||||
}
|
||||
w.Header().Set("Trailers", "not a special header field name")
|
||||
w.Header().Set("Trailer", "X-Trailer")
|
||||
w.Header().Set("X-Foo", "bar")
|
||||
w.Header().Set("Upgrade", "foo")
|
||||
@ -86,6 +87,9 @@ func TestReverseProxy(t *testing.T) {
|
||||
if c := res.Header.Get(fakeHopHeader); c != "" {
|
||||
t.Errorf("got %s header value %q", fakeHopHeader, c)
|
||||
}
|
||||
if g, e := res.Header.Get("Trailers"), "not a special header field name"; g != e {
|
||||
t.Errorf("header Trailers = %q; want %q", g, e)
|
||||
}
|
||||
if g, e := len(res.Header["X-Multi-Value"]), 2; g != e {
|
||||
t.Errorf("got %d X-Multi-Value header values; expected %d", g, e)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user