diff options
Diffstat (limited to 'vendor/golang.org/x/crypto/acme/http.go')
-rw-r--r-- | vendor/golang.org/x/crypto/acme/http.go | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/vendor/golang.org/x/crypto/acme/http.go b/vendor/golang.org/x/crypto/acme/http.go index 56ba53a..a43ce6a 100644 --- a/vendor/golang.org/x/crypto/acme/http.go +++ b/vendor/golang.org/x/crypto/acme/http.go @@ -140,10 +140,13 @@ func (c *Client) get(ctx context.Context, url string, ok resOkay) (*http.Respons case ok(res): return res, nil case isRetriable(res.StatusCode): - res.Body.Close() retry.inc() - if err := retry.backoff(ctx, req, res); err != nil { - return nil, err + resErr := responseError(res) + res.Body.Close() + // Ignore the error value from retry.backoff + // and return the one from last retry, as received from the CA. + if retry.backoff(ctx, req, res) != nil { + return nil, resErr } default: defer res.Body.Close() @@ -169,20 +172,22 @@ func (c *Client) post(ctx context.Context, key crypto.Signer, url string, body i if ok(res) { return res, nil } - err = responseError(res) + resErr := responseError(res) res.Body.Close() switch { // Check for bad nonce before isRetriable because it may have been returned // with an unretriable response code such as 400 Bad Request. - case isBadNonce(err): + case isBadNonce(resErr): // Consider any previously stored nonce values to be invalid. c.clearNonces() case !isRetriable(res.StatusCode): - return nil, err + return nil, resErr } retry.inc() + // Ignore the error value from retry.backoff + // and return the one from last retry, as received from the CA. if err := retry.backoff(ctx, req, res); err != nil { - return nil, err + return nil, resErr } } } |