aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorFrancis Lavoie <[email protected]>2024-10-22 11:38:49 -0400
committerFrancis Lavoie <[email protected]>2024-10-22 11:40:53 -0400
commitca6317b2fc85beeba4517f9d50851d1134b34b39 (patch)
tree6b7f77e314bb6e7267d091c52b6f4307f7bbd8c3
parent690219f681f597701ea3b9205c39d0cef583caa4 (diff)
downloadcaddy-1xx-stdlib.tar.gz
caddy-1xx-stdlib.zip
Use clear()1xx-stdlib
https://github.com/golang/go/commit/3bc28402fae2a1646e4d2756344b5eb34994d25f
-rw-r--r--modules/caddyhttp/headers/headers.go4
-rw-r--r--modules/caddyhttp/reverseproxy/reverseproxy.go4
2 files changed, 2 insertions, 6 deletions
diff --git a/modules/caddyhttp/headers/headers.go b/modules/caddyhttp/headers/headers.go
index a3279d913..c66bd4144 100644
--- a/modules/caddyhttp/headers/headers.go
+++ b/modules/caddyhttp/headers/headers.go
@@ -200,9 +200,7 @@ func (ops HeaderOps) ApplyTo(hdr http.Header, repl *caddy.Replacer) {
for _, fieldName := range ops.Delete {
fieldName = repl.ReplaceKnown(fieldName, "")
if fieldName == "*" {
- for existingField := range hdr {
- delete(hdr, existingField)
- }
+ clear(hdr)
}
}
diff --git a/modules/caddyhttp/reverseproxy/reverseproxy.go b/modules/caddyhttp/reverseproxy/reverseproxy.go
index a32994e04..1250eae6c 100644
--- a/modules/caddyhttp/reverseproxy/reverseproxy.go
+++ b/modules/caddyhttp/reverseproxy/reverseproxy.go
@@ -826,9 +826,7 @@ func (h *Handler) reverseProxy(rw http.ResponseWriter, req *http.Request, origRe
// Clear headers coming from the backend
// (it's not automatically done by ResponseWriter.WriteHeader() for 1xx responses)
- for k := range header {
- delete(h, k)
- }
+ clear(h)
return nil
},