From e7312b1005e77633a4fbd3a5cbb371aef45b0867 Mon Sep 17 00:00:00 2001 From: Damien Neil Date: Fri, 2 Sep 2022 14:48:28 -0700 Subject: [PATCH] net/http: correctly test for leading header spaces in TestReadRequest_Bad TestReadRequest_Bad's tests for leading whitespace in the first header were also exercising the test verifying that a HEAD request has no Content-Length. Also, the test intended to test a leading tab was actually testing for a leading \t (literal backslash, literal t). Change-Id: I05b46d05851b49bf75f1d1257c421b953b66ea9c Reviewed-on: https://go-review.googlesource.com/c/go/+/428134 Reviewed-by: Cherry Mui Run-TryBot: Damien Neil TryBot-Result: Gopher Robot Reviewed-by: Brad Fitzpatrick --- src/net/http/readrequest_test.go | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/net/http/readrequest_test.go b/src/net/http/readrequest_test.go index a6a12a0ddd..ba5cf4a261 100644 --- a/src/net/http/readrequest_test.go +++ b/src/net/http/readrequest_test.go @@ -455,12 +455,10 @@ Host: foo Content-Length: 5`)}, // golang.org/issue/22464 - {"leading_space_in_header", reqBytes(`HEAD / HTTP/1.1 - Host: foo -Content-Length: 5`)}, - {"leading_tab_in_header", reqBytes(`HEAD / HTTP/1.1 -\tHost: foo -Content-Length: 5`)}, + {"leading_space_in_header", reqBytes(`GET / HTTP/1.1 + Host: foo`)}, + {"leading_tab_in_header", reqBytes(`GET / HTTP/1.1 +` + "\t" + `Host: foo`)}, } func TestReadRequest_Bad(t *testing.T) { -- 2.48.1