summaryrefslogtreecommitdiff
path: root/modules/caddyhttp
diff options
context:
space:
mode:
authorAlexander Graf <ghostwheel42@users.noreply.github.com>2022-10-29 22:35:44 +0200
committerGitHub <noreply@github.com>2022-10-29 16:35:44 -0400
commit087f126cf4c8750424b26f177aa7f426be806b7f (patch)
treea9bd16aa20568ef787d7f9887f2048597a0d88da /modules/caddyhttp
parent1fa4cb7ba15b2e3166a30258fd99e13eac5fdd0e (diff)
caddyhttp: Canonicalize header field names (#5176)
Diffstat (limited to 'modules/caddyhttp')
-rw-r--r--modules/caddyhttp/staticresp.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/modules/caddyhttp/staticresp.go b/modules/caddyhttp/staticresp.go
index 411a7bc..add5b12 100644
--- a/modules/caddyhttp/staticresp.go
+++ b/modules/caddyhttp/staticresp.go
@@ -21,6 +21,7 @@ import (
"fmt"
"io"
"net/http"
+ "net/textproto"
"os"
"strconv"
"strings"
@@ -193,7 +194,7 @@ func (s StaticResponse) ServeHTTP(w http.ResponseWriter, r *http.Request, next H
// set all headers
for field, vals := range s.Headers {
- field = repl.ReplaceAll(field, "")
+ field = textproto.CanonicalMIMEHeaderKey(repl.ReplaceAll(field, ""))
newVals := make([]string, len(vals))
for i := range vals {
newVals[i] = repl.ReplaceAll(vals[i], "")