MatchWithError returns true if r matches m.
(r *http.Request)
| 712 | |
| 713 | // MatchWithError returns true if r matches m. |
| 714 | func (m MatchPathRE) MatchWithError(r *http.Request) (bool, error) { |
| 715 | repl := r.Context().Value(caddy.ReplacerCtxKey).(*caddy.Replacer) |
| 716 | |
| 717 | // Clean the path, merges doubled slashes, etc. |
| 718 | // This ensures maliciously crafted requests can't bypass |
| 719 | // the path matcher. See #4407 |
| 720 | cleanedPath := cleanPath(r.URL.Path) |
| 721 | |
| 722 | return m.MatchRegexp.Match(cleanedPath, repl), nil |
| 723 | } |
| 724 | |
| 725 | // CELLibrary produces options that expose this matcher for use in CEL |
| 726 | // expression matchers. |