|
@@ -89,17 +89,12 @@ func (b *blobDownload) Prepare(ctx context.Context, requestURL *url.URL, opts *R
|
|
|
}
|
|
|
|
|
|
if len(b.Parts) == 0 {
|
|
|
- resp, err := makeRequest(ctx, http.MethodHead, requestURL, nil, nil, opts)
|
|
|
+ resp, err := makeRequestWithRetry(ctx, http.MethodHead, requestURL, nil, nil, opts)
|
|
|
if err != nil {
|
|
|
return err
|
|
|
}
|
|
|
defer resp.Body.Close()
|
|
|
|
|
|
- if resp.StatusCode >= http.StatusBadRequest {
|
|
|
- body, _ := io.ReadAll(resp.Body)
|
|
|
- return fmt.Errorf("registry responded with code %d: %v", resp.StatusCode, string(body))
|
|
|
- }
|
|
|
-
|
|
|
b.Total, _ = strconv.ParseInt(resp.Header.Get("Content-Length"), 10, 64)
|
|
|
|
|
|
var size = b.Total / numDownloadParts
|
|
@@ -199,7 +194,7 @@ func (b *blobDownload) run(ctx context.Context, requestURL *url.URL, opts *Regis
|
|
|
func (b *blobDownload) downloadChunk(ctx context.Context, requestURL *url.URL, w io.Writer, part *blobDownloadPart, opts *RegistryOptions) error {
|
|
|
headers := make(http.Header)
|
|
|
headers.Set("Range", fmt.Sprintf("bytes=%d-%d", part.StartsAt(), part.StopsAt()-1))
|
|
|
- resp, err := makeRequest(ctx, http.MethodGet, requestURL, headers, nil, opts)
|
|
|
+ resp, err := makeRequestWithRetry(ctx, http.MethodGet, requestURL, headers, nil, opts)
|
|
|
if err != nil {
|
|
|
return err
|
|
|
}
|