diff --git a/lib/net/http.rb b/lib/net/http.rb index d1e9b2b..3a7345f 100644 --- a/lib/net/http.rb +++ b/lib/net/http.rb @@ -2501,8 +2501,6 @@ def transport_request(req) begin res = HTTPResponse.read_new(@socket) res.decode_content = req.decode_content - res.body_encoding = @response_body_encoding - res.ignore_eof = @ignore_eof if res.kind_of?(HTTPInformation) informational_count += 1 raise HTTPBadResponse, 'too many informational responses' if @@ -2510,10 +2508,11 @@ def transport_request(req) end end while res.kind_of?(HTTPInformation) - res.uri = req.uri - res } + res.body_encoding = @response_body_encoding + res.ignore_eof = @ignore_eof + res.uri = req.uri res.reading_body(@socket, req.response_body_permitted?) { if block_given? count = max_retries # Don't restart in the middle of a download