the open-uri package (which seem to be integrated into ruby 1.8.0)
handles redirects for you.

http://raa.ruby-lang.org/list.rhtml?name=open-uri

  / erik 

>>>>> "Eugene" == Eugene Scripnik <Eugene.Scripnik / itgrp.net> writes:

  Eugene> If I fetch index page from some site (say
  Eugene> http://www.somesite.org/) with Net::HTTP and get response
  Eugene> which tells me to redirect to
  Eugene> http://some_unique_id.somesite.org/, how do I redirect to
  Eugene> this new host?

  Eugene> I've tryed to make new request with this new uri but it
  Eugene> fails while trying to resolve this new hostname. But I need
  Eugene> to connect to old host but with new 'Host' parameter in
  Eugene> header.

  Eugene> fetch.rb: #!/usr/local/bin/ruby -w

  Eugene> require 'net/http' require 'uri'

  Eugene> uri = 'http://www.somesite.org/' response =
  Eugene> Net::HTTP.get_response( URI.parse( uri ) ) while
  Eugene> Net::HTTPRedirection === response puts response['Location']
  Eugene> response = Net::HTTP.get_response( URI.parse(
  Eugene> response['Location'] ) ) end p response




-- 
ee / opera.com +4613203202(work) +46705228912(cell) +4613102599(home)