mirror of
https://github.com/caddyserver/caddy.git
synced 2025-10-19 07:43:17 +00:00
caddyhttp: Normalize (lowercase) {label.N} placeholders
This commit is contained in:
parent
b866a9e099
commit
e0a8f9541d
1 changed files with 2 additions and 2 deletions
|
@ -289,7 +289,7 @@ func addHTTPVarsToReplacer(repl *caddy.Replacer, req *http.Request, w http.Respo
|
||||||
return prefix.String(), true
|
return prefix.String(), true
|
||||||
}
|
}
|
||||||
|
|
||||||
// hostname labels
|
// hostname labels (case insensitive, so normalize to lowercase)
|
||||||
if strings.HasPrefix(key, reqHostLabelsReplPrefix) {
|
if strings.HasPrefix(key, reqHostLabelsReplPrefix) {
|
||||||
idxStr := key[len(reqHostLabelsReplPrefix):]
|
idxStr := key[len(reqHostLabelsReplPrefix):]
|
||||||
idx, err := strconv.Atoi(idxStr)
|
idx, err := strconv.Atoi(idxStr)
|
||||||
|
@ -304,7 +304,7 @@ func addHTTPVarsToReplacer(repl *caddy.Replacer, req *http.Request, w http.Respo
|
||||||
if idx >= len(hostLabels) {
|
if idx >= len(hostLabels) {
|
||||||
return "", true
|
return "", true
|
||||||
}
|
}
|
||||||
return hostLabels[len(hostLabels)-idx-1], true
|
return strings.ToLower(hostLabels[len(hostLabels)-idx-1]), true
|
||||||
}
|
}
|
||||||
|
|
||||||
// path parts
|
// path parts
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue