]> Cypherpunks repositories - gostls13.git/commit
net/http: remove Content-Length header in http.Error
authorDamien Neil <dneil@google.com>
Sat, 6 Jan 2024 00:10:33 +0000 (16:10 -0800)
committerDamien Neil <dneil@google.com>
Thu, 29 Feb 2024 19:48:56 +0000 (19:48 +0000)
commit4e7bd20f8fdccdb2f0f30b051e3ea3fffb449367
treece2ac02a231da90aed6007e0e209d64e9fa43b21
parentadc575e64c8a49c0a14a8a6b0480c5f9815bdb1a
net/http: remove Content-Length header in http.Error

Error replies to a request with an error message and HTTP code.
Delete any preexisting Content-Length header before writing the header;
if a Content-Length is present, it's probably for content that the
caller has given up on writing.

For #50905

Change-Id: Ia3d4ca008be46fa5d41afadf29ca5cacb1c47660
Reviewed-on: https://go-review.googlesource.com/c/go/+/554216
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
src/net/http/serve_test.go
src/net/http/server.go