- From: Charles McCathieNevile <charles@w3.org>
- Date: Wed, 25 Sep 2002 16:20:21 -0400 (EDT)
- To: Dan Brickley <danbri@w3.org>
- cc: <www-archive+esw@w3.org>, <libby.miller@bristol.ac.uk>
#handling redirect code
h = Net::HTTP.new(ARGV[0] || 'www.ruby-lang.org', 80)
url = ARGV[1] || '/'
begin
resp, data = h.get(url, nil) { |a| }
rescue Net::ProtoRetriableError => detail
head = detail.data
if head.code == "301"
uri = URI.create(head['location'])
host = uri['host']
url = uri['path']
port = uri['port']
h.finish
h = Net::HTTP.new(host,Ęport)
retry
end
end
Received on Wednesday, 25 September 2002 16:20:24 UTC