diff --git a/pkg/blob/downloader.go b/pkg/blob/downloader.go index c082669adc..9e00d97c1e 100644 --- a/pkg/blob/downloader.go +++ b/pkg/blob/downloader.go @@ -57,6 +57,10 @@ func (d *downloader) Download(ctx context.Context, pathOrURI string) (Blob, erro path, err = paths.URIToFilePath(pathOrURI) case "http", "https": path, err = d.handleHTTP(ctx, pathOrURI) + if err != nil { + // retry as we sometimes see `wsarecv: An existing connection was forcibly closed by the remote host.` on Windows + path, err = d.handleHTTP(ctx, pathOrURI) + } default: err = fmt.Errorf("unsupported protocol %s in URI %s", style.Symbol(parsedURL.Scheme), style.Symbol(pathOrURI)) } diff --git a/pkg/blob/downloader_test.go b/pkg/blob/downloader_test.go index f4c97e29e1..e1bc7952cf 100644 --- a/pkg/blob/downloader_test.go +++ b/pkg/blob/downloader_test.go @@ -141,6 +141,10 @@ func testDownloader(t *testing.T, when spec.G, it spec.S) { server.AppendHandlers(func(w http.ResponseWriter, r *http.Request) { w.WriteHeader(404) }) + + server.AppendHandlers(func(w http.ResponseWriter, r *http.Request) { + w.WriteHeader(404) + }) }) it("should return error", func() {