func (m MatchPathRE) Match(r *http.Request) bool {
	repl := r.Context().Value(caddy.ReplacerCtxKey).(*caddy.Replacer)

	// PathUnescape returns an error if the escapes aren't
	// well-formed, meaning the count % matches the RFC.
	// Return early if the escape is improper.
	unescapedPath, err := url.PathUnescape(r.URL.Path)
	if err != nil {
		return false
	}

	// Clean the path, merges doubled slashes, etc.
	// This ensures maliciously crafted requests can't bypass
	// the path matcher. See #4407
	cleanedPath := path.Clean(unescapedPath)

	// Cleaning may remove the trailing slash, but we want to keep it
	if cleanedPath != "/" && strings.HasSuffix(r.URL.Path, "/") {
		cleanedPath = cleanedPath + "/"
	}

	return m.MatchRegexp.Match(cleanedPath, repl)
}
// Match returns true if r matches m.
Match returns true if r matches m.
// Match returns true if r matches m .
func (m MatchPathRE) Match(r *http.Request) bool {
	repl := r.Context().Value(caddy.ReplacerCtxKey).(*caddy.Replacer)
	unescapedPath, err := url.PathUnescape(r.URL.Path)
	if err != nil {
		return false
	}
	cleanedPath := path.Clean(unescapedPath)
	if cleanedPath != "/" && strings.HasSuffix(r.URL.Path, "/") {
		cleanedPath = cleanedPath + "/"
	}
	return m.MatchRegexp.Match(cleanedPath, repl)
}
func ( m MatchPathRE ) Match ( r * http . Request ) bool { repl := r . Context ( ) . Value ( caddy . ReplacerCtxKey ) . ( * caddy . Replacer ) unescapedPath , err := url . PathUnescape ( r . URL . Path ) if err != nil { return false } cleanedPath := path . Clean ( unescapedPath ) if cleanedPath != " " && strings . HasSuffix ( r . URL . Path , " " ) { cleanedPath = cleanedPath + " " } return m . MatchRegexp . Match ( cleanedPath , repl ) }
Match returns true if r matches m.
Match returns true if r matches m .
// PathUnescape returns an error if the escapes aren't // well-formed, meaning the count % matches the RFC. // Return early if the escape is improper. // Clean the path, merges doubled slashes, etc. // This ensures maliciously crafted requests can't bypass // the path matcher. See #4407 // Cleaning may remove the trailing slash, but we want to keep it