Hi Ned,

  In mail "[ruby-talk:21414] Net::HTTP.get not returning data (1.7.1, ok in 1.6.4)"
    Ned Konz <ned / bike-nomad.com> wrote:

> h = Net::HTTP.new('www.pragmaticprogrammer.com', 80)
> resp,data = h.get('/index.html', nil)
> puts resp.code
> puts data # data is nil
> 
> However, data is returned as nil.

It's a feature. In 1.7 Net::HTTP#get,post returns only HTTPResponse.
In addition, it does not raise exceptions when code 3xx (redirect).
If you want http.rb 1.6 style, put "Net::HTTP.version_1_1" before
Net::HTTP.new.


> If I use a block after h.get I see data.

Hmm. On my box I cannot get data.

    require 'net/http'

    ret = ''
    resp = data = nil
    Net::HTTP.start( 'localhost', 8080 ) {|h|
	resp, data = h.get('/') do |str|
	  ret << str
	end
    }
    p resp
    p data

    ---- result ----
    #<Net::NetPrivate::HTTPResponse 200>
    nil

Minero Aoki