From: Eugene Scripnik Date: 2003-02-24T21:44:11+09:00 Subject: Fetching pages with Net::HTTP If I fetch index page from some site (say http://www.somesite.org/) with Net::HTTP and get response which tells me to redirect to http://some_unique_id.somesite.org/, how do I redirect to this new host? I've tryed to make new request with this new uri but it fails while trying to resolve this new hostname. But I need to connect to old host but with new 'Host' parameter in header. fetch.rb: #!/usr/local/bin/ruby -w require 'net/http' require 'uri' uri = 'http://www.somesite.org/' 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