]> Cypherpunks repositories - gostls13.git/commit
net/http: remove misleading response headers on error
authorMitar <mitar.git@tnode.com>
Tue, 5 Mar 2024 23:45:51 +0000 (23:45 +0000)
committerGopher Robot <gobot@golang.org>
Wed, 6 Mar 2024 19:15:50 +0000 (19:15 +0000)
commitd463de61b38cc037808970a8aeed8255082a1df5
treecdb19e1861072e98074a96530b4ac5c67f3495df
parent25af691c43efdc4ff15e3b5355d1f2638bd67e0a
net/http: remove misleading response headers on error

ServeContent API is to set some headers you want to see in the response
before calling ServeContent. But if there is an error, those headers
should be removed otherwise they might confused the client.

Removing those headers is useful in general in the case of an error,
so we remove them in http.Error.

Fixes #50905.

Change-Id: If8d2786c1512906ac93e6b388df6ab1c5ecd1ea9
GitHub-Last-Rev: 32b6f045a791cf7bc391f018452a05cc872041ba
GitHub-Pull-Request: golang/go#64312
Reviewed-on: https://go-review.googlesource.com/c/go/+/544019
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Damien Neil <dneil@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
src/net/http/fs_test.go
src/net/http/server.go