From: Eugene Scripnik Date: 2003-02-25T20:44:04+09:00 Subject: Re: small bug in net/http.rb NAKAMURA, Hiroshi wrote: >>I am still don't know how to follow redirect to new dynamic >>web host on >>the same real host. Is it possible with Net::HTTP? > > > Can you tell us the actual site you are testing? > > With my module http-access2 (see RAA), > ruby -rhttp-access2 > -e 'p HTTPClient.new.getContent("http://...")' > should follow redirect(s). But the script you posted > with Net::HTTP should work as well I think. > ok, i'll take a look at http-access2. try my script bellow - it fails with message: getaddrinfo: No address associated with hostname fetch.rb: #!/usr/local/bin/ruby -w require 'net/http' require 'uri' uri = 'http://www.sms.de/' response = Net::HTTP.get_response( URI.parse( uri ) ) while Net::HTTPRedirection === response puts response['Location'] response = Net::HTTP.get_response( URI.parse( response['Location'] ) ) end p response