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

Function StatusCodeMatches

modules/caddyhttp/caddyhttp.go:230–240  ·  modules/caddyhttp/caddyhttp.go::StatusCodeMatches

StatusCodeMatches returns true if a real HTTP status code matches the configured status code, which may be either a real HTTP status code or an integer representing a class of codes (e.g. 4 for all 4xx statuses).

(actual, configured int)

Source from the content-addressed store, hash-verified

228// code or an integer representing a class of codes (e.g. 4 for all
229// 4xx statuses).
230func StatusCodeMatches(actual, configured int) bool {
231 if actual == configured {
232 return true
233 }
234 if configured < 100 &&
235 actual >= configured*100 &&
236 actual < (configured+1)*100 {
237 return true
238 }
239 return false
240}
241
242// SanitizedPathJoin performs filepath.Join(root, reqPath) that
243// is safe against directory traversal attacks. It uses logic

Callers 3

doActiveHealthCheckMethod · 0.92
reverseProxyMethod · 0.92
matchStatusCodeMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected