mirror of
https://github.com/caddyserver/caddy.git
synced 2024-12-28 06:33:47 +03:00
caddyhttp: Canonicalize header field names (#5176)
This commit is contained in:
parent
1fa4cb7ba1
commit
087f126cf4
1 changed files with 2 additions and 1 deletions
|
@ -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…
Reference in a new issue