From: "naruse (Yui NARUSE)" Date: 2012-09-02T05:38:23+09:00 Subject: [ruby-core:47389] [ruby-trunk - Bug #6957][Rejected] Net::HTTP#request_get bug Issue #6957 has been updated by naruse (Yui NARUSE). Status changed from Open to Rejected I understand what you say, but it is because of compatibility. Please use break as you wrote. ---------------------------------------- Bug #6957: Net::HTTP#request_get bug https://bugs.ruby-lang.org/issues/6957#change-29128 Author: kl (Kalle Lindstr��m) Status: Rejected Priority: Normal Assignee: Category: Target version: ruby -v: ruby 1.9.3p194 (2012-04-20) [i386-mingw32] Hello, Looking at the source for Net::HTTP#request_get it says that if you pass in a block it will not read the body unless you call #read_body on the response. But when I pass in a block it seems that it reads the when the block exits, even though I did not call #read_body on the request. Consider this example: url = "http://download.microsoft.com/download/1/6/5/165b076b-aaa9-443d-84f0-73cf11fdcdf8/WindowsXP-KB835935-SP2-ENU.exe" uri = URI(url) http = Net::HTTP.new(uri.hostname, uri.port) http.request_get(uri.request_uri) do |req| puts req["content-length"] end # Program stops here for a long time - it must be downloading the body of the file? compared to this: http.request_get(uri.request_uri) do |req| puts req["content-length"] break # Now this method works as expected, it exits at this point without any delay end -- http://bugs.ruby-lang.org/