forked from Ivasoft/traefik
add access log filter for retry attempts
This commit is contained in:
committed by
Traefiker Bot
parent
5792a19b97
commit
c762b9bb2e
@@ -540,7 +540,7 @@ func (clientTLS *ClientTLS) CreateTLSConfig() (*tls.Config, error) {
|
||||
// HTTPCodeRanges holds HTTP code ranges
|
||||
type HTTPCodeRanges [][2]int
|
||||
|
||||
// NewHTTPCodeRanges create a new NewHTTPCodeRanges from a given []string].
|
||||
// NewHTTPCodeRanges creates HTTPCodeRanges from a given []string.
|
||||
// Break out the http status code ranges into a low int and high int
|
||||
// for ease of use at runtime
|
||||
func NewHTTPCodeRanges(strBlocks []string) (HTTPCodeRanges, error) {
|
||||
@@ -563,3 +563,14 @@ func NewHTTPCodeRanges(strBlocks []string) (HTTPCodeRanges, error) {
|
||||
}
|
||||
return blocks, nil
|
||||
}
|
||||
|
||||
// Contains tests whether the passed status code is within
|
||||
// one of its HTTP code ranges.
|
||||
func (h HTTPCodeRanges) Contains(statusCode int) bool {
|
||||
for _, block := range h {
|
||||
if statusCode >= block[0] && statusCode <= block[1] {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user