@marcel91200 / caddy Mirror · read-only / commits / 654a3bb0
Fork 0

Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS

Mirrored from https://github.com/Slazee/caddy.git

Synced Nov 12, 14:30 UTC

caddyhttp: remove duplicate strings.Count in path matcher (fixes #6233) (#6234)

Hugues Lismonde committed Apr 10, 2024 at 16:38 UTC 654a3bb09095425a1260895dd2edf09edc3403e8
1 file changed +1 -2
modules/caddyhttp/matchers.go
+1 -2
@@ -456,8 +456,7 @@ func (m MatchPath) Match(r *http.Request) bool {
456 // treat it as a fast substring match
457 if strings.Count(matchPattern, "*") == 2 &&
458 strings.HasPrefix(matchPattern, "*") &&
459 - strings.HasSuffix(matchPattern, "*") &&
460 - strings.Count(matchPattern, "*") == 2 {
459 + strings.HasSuffix(matchPattern, "*") {
460 if strings.Contains(reqPathForPattern, matchPattern[1:len(matchPattern)-1]) {
461 return true
462 }