Commit Graph

11 Commits

Author SHA1 Message Date
Miloslav Trmač 99851b45be Add a comment to httpResponseToError
Make it harder to not use the right function.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2021-08-26 03:33:10 +02:00
Miloslav Trmač 550a81f757 Handle the GetBlobAt special cases of HTTP status code in there
No point in handling them in generic code, and callers that
aren't expecting StatusPartialContent could be confused.

Should not change behavior of GetBlobAt; might in change behavior of
other callers if they unexpectedly received the relevant HTTP status
codes.

This ~mechanically moves the code without much restructuring.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2021-08-26 03:33:10 +02:00
Miloslav Trmač bc5c78d29b Simplify a check for client.UnexpectedHTTPResponseError
github.com/docker/distribution is not using the github.com/pkg/errors
wrapping mechanism, and we don't expect them to start.

Should not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2021-08-26 03:33:10 +02:00
Miloslav Trmač 53dd5f2578 Rename errResponse to err
just to minimize repetition; the Reponse qualifier applies to
everything in that function, so it doesn't help.

Should not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2021-08-26 03:33:10 +02:00
Giuseppe Scrivano 93477e61a3
docker: support partial blob retrieval
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2021-07-02 14:36:51 +02:00
Daniel J Walsh cdd6817ed6
Change all references to docker registry to container registry
Will leave references to distribution spec until there is an OCI Spec we
can point at.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-06-30 15:34:06 -04:00
Qi Wang 13e91ac645 Return error body if UnexpectedHTTPResponseError
Format the error message use the response body if the original error is returned as client.UnexpectedHTTPResponseError type

Signed-off-by: Qi Wang <qiwan@redhat.com>
2020-08-31 20:31:10 -04:00
Miloslav Trmač cc9b2c8faa Fix up the wording a bit in various places
E.g.
- Capitalize log messages
- Add a bit more context to the log messages
- Don't commit to specific fallback behavior in the API, only say that it may automatically retry.
- Fix some typos

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2020-01-06 17:23:57 +01:00
Miloslav Trmač 75cb5d58cd Re-add some context to unexpected HTTP status errors
... to indicate the operation that failed

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2020-01-06 17:23:57 +01:00
Qi Wang 9c14d60bf5 return resp error message
follow https://github.com/containers/image/pull/709
return and wrap http response message to show server-side error message.

Signed-off-by: Qi Wang <qiwan@redhat.com>
2019-10-24 14:20:06 -04:00
Valentin Rothberg d51a7cabae docker: handle http 429 status codes
Consolidate checking the http-status codes to allow for a more uniform
error handling.  Also treat code 429 (too many requests) as a known
error instead of an invalid status code.

When hitting 429, perform an exponential back off starting a 2 seconds
for at most 5 iterations.  If the http.Response set the `Retry-Header`
then use the provided value or date to compute the delay until the
next attempt.  Note that the maximum delay is 60 seconds.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2019-10-18 11:47:57 +02:00