hashicorp / go-retryablehttp

Retryable HTTP client in Go
Mozilla Public License 2.0
1.99k stars 251 forks source link

Detect that GET was terminated early and retry #152

Open mitar opened 2 years ago

mitar commented 2 years ago

I am trying to download a large file over HTTP and connection is getting simply terminated by the server. With wget it automatically retries because it knows that download has not yet reached Content-Length response size. But I was hoping that this package will also retry but it seems this is not so. So I am opening a feature request to suggest that it should retry also if:

mitar commented 2 years ago

In particular, it does not look like the package retries GET requests at all. The initial resp.Body is passed as-is so if the request is retried, it does not continue reading where it left of.

mitar commented 2 years ago

I have made it, a RetryableResponse: https://pkg.go.dev/gitlab.com/tozd/go/x#RetryableResponse