From: "Hal E. Fulton" Date: 2003-06-06T03:08:21+09:00 Subject: Re: Ruby 1.8.0 net/http bug ----- Original Message ----- From: "Urban Nilsson" To: "ruby-talk ML" Sent: Thursday, June 05, 2003 12:54 PM Subject: Ruby 1.8.0 net/http bug > I tried the following example code: > > require 'net/http' > h = Net::HTTP.new('www.pragmaticprogrammer.com', 80) > resp, data = h.get('/index.html', nil) > puts "Code = #{resp.code}" > puts "Message = #{resp.message}" > resp.each {|val, key| printf "%-14s = %-40.40s\n", key, val } > p data[0..55] > > > This ran as expected under ruby 1.6.7 (2002-03-01) [powerpc-darwin6.0] > but when I ran it under ruby 1.8.0 (2003-05-26) [powerpc-darwin6.6] the > data variable was nil, resulting in a "net.rb:8: undefined method `[]' > for nil (NoMethodError)". resp was the same under both versions however. > > What can I do to narrow this problem down? It's a change in the interface, breaking old code. This bit me a couple of weeks ago, and Austin Ziegler pointed it out to me: > For VERSION =~ /1.[789]/, Net::HTTP#get has been changed: > > resp = h.get("/", nil) > data = resp.body More logical, perhaps, but incompatible. Hal