From e9d5292b0c4a26ed51a66437b8ab0dba03f65b8f Mon Sep 17 00:00:00 2001 From: Derek McGowan Date: Wed, 20 Jan 2016 14:29:38 -0800 Subject: [PATCH] Unwrap URL errors on retry When authorization errors are returned by the token process the error will be wrapped in url.Error. In order to check the underlying error for retry this error message should be unwrapped. Unwrapping this error allows failure to push due to an unauthorized response to keep from retrying, possibly resulting in later 429 responses. Signed-off-by: Derek McGowan (github: dmcgowan) --- distribution/registry.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/distribution/registry.go b/distribution/registry.go index 1d4a2c4efe..1e7adcb162 100644 --- a/distribution/registry.go +++ b/distribution/registry.go @@ -145,6 +145,8 @@ func retryOnError(err error) error { case errcode.ErrorCodeUnauthorized, errcode.ErrorCodeUnsupported, errcode.ErrorCodeDenied: return xfer.DoNotRetry{Err: err} } + case *url.Error: + return retryOnError(v.Err) case *client.UnexpectedHTTPResponseError: return xfer.DoNotRetry{Err: err} }