MCPcopy
hub / github.com/caddyserver/caddy / adminPathAllowed

Function adminPathAllowed

admin.go:725–736  ·  view source on GitHub ↗
(reqPath, allowedPath string)

Source from the content-addressed store, hash-verified

723}
724
725func adminPathAllowed(reqPath, allowedPath string) bool {
726 if allowedPath == "" || allowedPath == "/" {
727 return strings.HasPrefix(reqPath, allowedPath)
728 }
729 if reqPath == allowedPath {
730 return true
731 }
732 if strings.HasSuffix(allowedPath, "/") {
733 return strings.HasPrefix(reqPath, allowedPath)
734 }
735 return strings.HasPrefix(reqPath, allowedPath+"/")
736}
737
738func stopAdminServer(srv *http.Server) error {
739 if srv == nil {

Callers 1

enforceAccessControlsMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected