mirror of
https://github.com/caddyserver/caddy.git
synced 2025-05-31 20:24:18 -04:00
caddyhttp: Canonicalize header field names (#5176)
This commit is contained in:
parent
1fa4cb7ba1
commit
087f126cf4
@ -21,6 +21,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/textproto"
|
||||||
"os"
|
"os"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
@ -193,7 +194,7 @@ func (s StaticResponse) ServeHTTP(w http.ResponseWriter, r *http.Request, next H
|
|||||||
|
|
||||||
// set all headers
|
// set all headers
|
||||||
for field, vals := range s.Headers {
|
for field, vals := range s.Headers {
|
||||||
field = repl.ReplaceAll(field, "")
|
field = textproto.CanonicalMIMEHeaderKey(repl.ReplaceAll(field, ""))
|
||||||
newVals := make([]string, len(vals))
|
newVals := make([]string, len(vals))
|
||||||
for i := range vals {
|
for i := range vals {
|
||||||
newVals[i] = repl.ReplaceAll(vals[i], "")
|
newVals[i] = repl.ReplaceAll(vals[i], "")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user