On Mon, 7 Aug 2006, Holger Biebinger wrote:

> Hi,
> In the following test script (similar to pickaxe p. 700 ):
>
> require 'net/http'
> require 'uri'
>
> def fetch (uri_str, limit=10)
>    fail 'http redirect limit exceeded' if limit.zero?
>    response = Net::HTTP.get_response(URI.parse(uri_str))
>    case response
>    when Net::HTTPSuccess
>      response
>    when Net::HTTPRedirection
>      fetch(response['location'], limit-1)
>    else
>      response.error!
>    end
> end
>
>
> fetch('heise.de');
          ^^^^^^^^
          ^^^^^^^^

this is not a uri.

try

   harp:~ > ruby -r uri -e'  p URI.parse("heise.de").host  '
   nil

   harp:~ > ruby -r uri -e'  p URI.parse("http://heise.de").host  '
   "heise.de"

regards.

-a
-- 
happiness is not something ready-made.  it comes from your own actions.
- h.h. the 14th dali lama