Dave Thomas <Dave / Thomases.com> writes:

>      h = Net::HTTP.new(ARGV[0] || 'www.ruby-lang.org', 80)
[...]
>        if head.code == "301"
>          uri = URI.create(head['location'])
[...]
>          retry
>        end

Not that bad of an idea. ;) But if "head = h.get()" fails and raises
an exception, head is nil and we get an "undefined method `[]' for nil
(NameError)" error.

And URI itself doesn't provide any techniques to track urls and
thereby follow automatic redirects.

        Roland