diff options
author | Matthew Holt <mholt@users.noreply.github.com> | 2019-09-02 22:01:02 -0600 |
---|---|---|
committer | Matthew Holt <mholt@users.noreply.github.com> | 2019-09-02 22:01:02 -0600 |
commit | 026df7c5cb33331d223afc6a9599274e8c89dfd9 (patch) | |
tree | e7101ef1197b26b02472a567998fb83b57a45f08 /modules/caddyhttp/caddyhttp.go | |
parent | 2dc4fcc62bfab639b60758f26659c03e58af9960 (diff) |
reverse_proxy: WIP refactor and support for FastCGI
Diffstat (limited to 'modules/caddyhttp/caddyhttp.go')
-rw-r--r-- | modules/caddyhttp/caddyhttp.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/modules/caddyhttp/caddyhttp.go b/modules/caddyhttp/caddyhttp.go index b4b1ec6..300b5fd 100644 --- a/modules/caddyhttp/caddyhttp.go +++ b/modules/caddyhttp/caddyhttp.go @@ -518,6 +518,20 @@ func (ws WeakString) String() string { return string(ws) } +// 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). +func StatusCodeMatches(actual, configured int) bool { + if actual == configured { + return true + } + if configured < 100 && actual >= configured*100 && actual < (configured+1)*100 { + return true + } + return false +} + const ( // DefaultHTTPPort is the default port for HTTP. DefaultHTTPPort = 80 |