diff options
Diffstat (limited to 'vendor/github.com/minio/minio-go/v7/retry.go')
-rw-r--r-- | vendor/github.com/minio/minio-go/v7/retry.go | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/vendor/github.com/minio/minio-go/v7/retry.go b/vendor/github.com/minio/minio-go/v7/retry.go index f454e675c..055c14c4d 100644 --- a/vendor/github.com/minio/minio-go/v7/retry.go +++ b/vendor/github.com/minio/minio-go/v7/retry.go @@ -19,7 +19,10 @@ package minio import ( "context" + "crypto/x509" + "errors" "net/http" + "net/url" "time" ) @@ -123,3 +126,23 @@ func isHTTPStatusRetryable(httpStatusCode int) (ok bool) { _, ok = retryableHTTPStatusCodes[httpStatusCode] return ok } + +// For now, all http Do() requests are retriable except some well defined errors +func isRequestErrorRetryable(err error) bool { + if errors.Is(err, context.Canceled) || errors.Is(err, context.DeadlineExceeded) { + return false + } + if ue, ok := err.(*url.Error); ok { + e := ue.Unwrap() + switch e.(type) { + // x509: certificate signed by unknown authority + case x509.UnknownAuthorityError: + return false + } + switch e.Error() { + case "http: server gave HTTP response to HTTPS client": + return false + } + } + return true +} |