Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS
Mirrored from https://github.com/Slazee/caddy.git
Synced Nov 13, 13:00 UTC
caddyhttp: Very minor optimization to path matcher
If * is in the matcher it will always match so we can just put it first.
Matthew Holt committed
Sep 13, 2022 at 11:26 UTC
20d487be573424e7647b5a157754f6e284554e23
1 file changed
+5
-1
modules/caddyhttp/matchers.go
+5
-1
@@ -374,7 +374,11 @@ func (MatchPath) CaddyModule() caddy.ModuleInfo {
374
// Provision lower-cases the paths in m to ensure case-insensitive matching.
375
func (m MatchPath) Provision(_ caddy.Context) error {
376
for i := range m {
377
- // TODO: if m[i] == "*", put it first and delete all others (will always match)
377
+ if m[i] == "*" && i > 0 {
378
+ // will always match, so just put it first
379
+ m[0] = m[i]
380
+ break
381
+ }
382
m[i] = strings.ToLower(m[i])
383
}
384
return nil