diff --git a/src/net/http/serve_test.go b/src/net/http/serve_test.go index 6394da3bb7..bfac783e3a 100644 --- a/src/net/http/serve_test.go +++ b/src/net/http/serve_test.go @@ -6189,6 +6189,7 @@ func TestUnsupportedTransferEncodingsReturn501(t *testing.T) { "fugazi", "foo-bar", "unknown", + "\rchunked", } for _, badTE := range unsupportedTEs { diff --git a/src/net/http/transfer.go b/src/net/http/transfer.go index 85c2e5a360..3894007d30 100644 --- a/src/net/http/transfer.go +++ b/src/net/http/transfer.go @@ -639,7 +639,7 @@ func (t *transferReader) parseTransferEncoding() error { if len(raw) != 1 { return &unsupportedTEError{fmt.Sprintf("too many transfer encodings: %q", raw)} } - if !ascii.EqualFold(textproto.TrimString(raw[0]), "chunked") { + if !ascii.EqualFold(raw[0], "chunked") { return &unsupportedTEError{fmt.Sprintf("unsupported transfer encoding: %q", raw[0])} }