Net::HTTP#get?

This code fragment used to work for me:

begin
h = Net::HTTP.new(“www.whatever.com”, 80)
resp, data = h.get("/", nil)
rescue => err
puts "Error: #{err}"
exit
end

Now it doesn’t. What am I missing?

Hal

Worked for me after adding: require ‘net/http’ (obviously)

Are you behind a firewall ?

“Hal E. Fulton” hal9000@hypermetrics.com wrote in message
news:001001c31e85$44bfa5c0$0300a8c0@austin.rr.com

···

This code fragment used to work for me:

begin
h = Net::HTTP.new(“www.whatever.com”, 80)
resp, data = h.get(“/”, nil)
rescue => err
puts “Error: #{err}”
exit
end

Now it doesn’t. What am I missing?

Hal

For VERSION =~ /1.[789]/, Net::HTTP#get has been changed:

resp = h.get(“/”, nil)
data = resp.body

I guess it makes more sense than:

resp, = h.get(“/”, nil)

but it’s a major-league incompatible change.

-austin
– Austin Ziegler, austin@halostatue.ca on 2003.05.20 at 01:35:35

···

On Tue, 20 May 2003 13:02:20 +0900, Hal E. Fulton wrote:

This code fragment used to work for me:

begin
h = Net::HTTP.new(“www.whatever.com”, 80)
resp, data = h.get(“/”, nil)
rescue => err
puts “Error: #{err}”
exit
end

Now it doesn’t. What am I missing?