diff --git a/lib/net/http.rb b/lib/net/http.rb index 8ac80a4..101a669 100644 --- a/lib/net/http.rb +++ b/lib/net/http.rb @@ -2350,7 +2350,10 @@ def transport_request(req) res } res.reading_body(@socket, req.response_body_permitted?) { - yield res if block_given? + if block_given? + count = max_retries # Don't restart in the middle of a download + yield res + end } rescue Net::OpenTimeout raise