mirror of
https://github.com/caddyserver/caddy.git
synced 2025-03-10 07:59:03 -04:00
caddyhttp: Corrected host label index check (fix #3502)
This commit is contained in:
parent
ddd690de4c
commit
77f233a484
@ -172,7 +172,7 @@ func addHTTPVarsToReplacer(repl *caddy.Replacer, req *http.Request, w http.Respo
|
|||||||
reqHost = req.Host // OK; assume there was no port
|
reqHost = req.Host // OK; assume there was no port
|
||||||
}
|
}
|
||||||
hostLabels := strings.Split(reqHost, ".")
|
hostLabels := strings.Split(reqHost, ".")
|
||||||
if idx > len(hostLabels) {
|
if idx >= len(hostLabels) {
|
||||||
return "", true
|
return "", true
|
||||||
}
|
}
|
||||||
return hostLabels[len(hostLabels)-idx-1], true
|
return hostLabels[len(hostLabels)-idx-1], true
|
||||||
|
@ -107,6 +107,10 @@ eqp31wM9il1n+guTNyxJd+FzVAH+hCZE5K+tCgVDdVFUlDEHHbS/wqb2PSIoouLV
|
|||||||
input: "{http.request.host.labels.1}",
|
input: "{http.request.host.labels.1}",
|
||||||
expect: "example",
|
expect: "example",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
input: "{http.request.host.labels.2}",
|
||||||
|
expect: "<empty>",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
input: "{http.request.tls.cipher_suite}",
|
input: "{http.request.tls.cipher_suite}",
|
||||||
expect: "TLS_AES_256_GCM_SHA384",
|
expect: "TLS_AES_256_GCM_SHA384",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user