Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS
Mirrored from https://github.com/Slazee/caddy.git
Synced Nov 13, 09:15 UTC
caddyhttp: Canonicalize header field names (#5176)
Alexander Graf committed
Oct 29, 2022 at 22:35 UTC
087f126cf4c8750424b26f177aa7f426be806b7f
1 file changed
+2
-1
modules/caddyhttp/staticresp.go
+2
-1
@@ -21,6 +21,7 @@ import (
21
"fmt"
22
"io"
23
"net/http"
24
+ "net/textproto"
25
"os"
26
"strconv"
27
"strings"
@@ -193,7 +194,7 @@ func (s StaticResponse) ServeHTTP(w http.ResponseWriter, r *http.Request, next H
194
195
// set all headers
196
for field, vals := range s.Headers {
196
- field = repl.ReplaceAll(field, "")
197
+ field = textproto.CanonicalMIMEHeaderKey(repl.ReplaceAll(field, ""))
198
newVals := make([]string, len(vals))
199
for i := range vals {
200
newVals[i] = repl.ReplaceAll(vals[i], "")