diff --git a/lib/net/http.rb b/lib/net/http.rb index 985a72f2..808731ef 100644 --- a/lib/net/http.rb +++ b/lib/net/http.rb @@ -1634,7 +1634,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