mirror of
https://github.com/caddyserver/caddy.git
synced 2024-12-16 21:56:40 -05:00
caddyhttp: Very minor optimization to path matcher
If * is in the matcher it will always match so we can just put it first.
This commit is contained in:
parent
61c75f74de
commit
20d487be57
1 changed files with 5 additions and 1 deletions
|
@ -374,7 +374,11 @@ func (MatchPath) CaddyModule() caddy.ModuleInfo {
|
|||
// Provision lower-cases the paths in m to ensure case-insensitive matching.
|
||||
func (m MatchPath) Provision(_ caddy.Context) error {
|
||||
for i := range m {
|
||||
// TODO: if m[i] == "*", put it first and delete all others (will always match)
|
||||
if m[i] == "*" && i > 0 {
|
||||
// will always match, so just put it first
|
||||
m[0] = m[i]
|
||||
break
|
||||
}
|
||||
m[i] = strings.ToLower(m[i])
|
||||
}
|
||||
return nil
|
||||
|
|
Loading…
Reference in a new issue