From: Ian Macdonald Date: 2004-03-05T19:16:41+09:00 Subject: Re: problem with Net::HTTP in 1.8.1 On Fri 05 Mar 2004 at 09:10:06 +0900, nobu.nokada@softhome.net wrote: > Hi, > > At Fri, 5 Mar 2004 08:53:38 +0900, > Ian Macdonald wrote in [ruby-core:02577]: > > The following code seems to cause an infinite loop: > > > > #!/usr/bin/ruby -w > > > > require 'net/http' > > > > http = Net::HTTP.start('www.google.com', 80) > > > > response = http.get('/') > > puts response.header > > > > > > This causes the following bogus message to be printed indefinitely: > > > > net/http.rb: warning: Net::HTTP v1.1 style assignment found at ./foo:8:in `puts'; use `response = http.get(...)' instead. > > HTTPResponse#to_ary returns an array contains itself, and #puts > tries to traverse it and causes infinite recursion. > > In the meantime, the following patch could get rid of the > problem. The patch fixes the recursive error, but I still can't get access to the @header hash. It seems that trying to read @header returns self, so that I end up with .header.header.header, etc. and can't actually dereference the hash. Ian -- Ian Macdonald | Absence diminishes mediocre passions and System Administrator | increases great ones, as the wind blows out ian@caliban.org | candles and fans fires. -- La http://www.caliban.org | Rochefoucauld |