From: guoguangwu Date: Fri, 1 Mar 2024 03:09:39 +0000 (+0000) Subject: net/http/cgi: close res.Body X-Git-Tag: go1.23rc1~1004 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=90796f44d5d10163196c6116ae667eddba8b06c0;p=gostls13.git net/http/cgi: close res.Body Change-Id: I4682442f4f9f3d112b78582c3b9fc2d24c2d58a7 GitHub-Last-Rev: 0823701905b8facdde7204aa6d90df6facd6dc51 GitHub-Pull-Request: golang/go#66049 Reviewed-on: https://go-review.googlesource.com/c/go/+/568316 LUCI-TryBot-Result: Go LUCI Reviewed-by: Damien Neil Reviewed-by: Michael Knyszek Auto-Submit: Damien Neil --- diff --git a/src/net/http/cgi/host_test.go b/src/net/http/cgi/host_test.go index f29395fe84..7fe0e6257d 100644 --- a/src/net/http/cgi/host_test.go +++ b/src/net/http/cgi/host_test.go @@ -385,12 +385,11 @@ func TestCopyError(t *testing.T) { if err != nil { t.Fatalf("Write: %v", err) } - res, err := http.ReadResponse(bufio.NewReader(conn), req) if err != nil { t.Fatalf("ReadResponse: %v", err) } - + defer res.Body.Close() var buf [5000]byte n, err := io.ReadFull(res.Body, buf[:]) if err != nil {