I have already explained. Change or monkey-patch the URI library.

2012/4/17, Jeroen van Ingen <lists / ruby-forum.com>:
> if I have the following url: http://auto_diversen.marktplaza.nl
>
> This works fine:
> URI::Parser.new(:HOSTNAME => "(?:[_a-zA-Z0-9\\-.]|%\\h\\h)+").parse(url)
>
> But this returns an error:
> URI::Parser.new(:HOSTNAME =>
> "(?:[_a-zA-Z0-9\\-.]|%\\h\\h)+").parse(url).open
> Returns: the scheme http does not accept registry part:
> auto_diversen.marktplaza.nl:80 (or bad hostname?)
>
> When I look to the source of 'open', It looks to be that it parses the
> URL again, so the error is raised.
> The source on:
> http://www.ruby-doc.org/stdlib-1.9.3/libdoc/open-uri/rdoc/Kernel.html#method-i-open
> # File open-uri.rb, line 27
> def open(name, *rest, &block) # :doc:
>   if name.respond_to?(:open)
>     name.open(*rest, &block)
>   elsif name.respond_to?(:to_str) &&
>         %{\A[A-Za-z][A-Za-z0-9+\-\.]*://} =~ name &&
>         (uri = URI.parse(name)).respond_to?(:open)
>     uri.open(*rest, &block)
>   else
>     open_uri_original_open(name, *rest, &block)
>   end
> end
>
> Anyone got an idea how to open the uri?
>
> --
> Posted via http://www.ruby-forum.com/.
>
>


-- 
-- Matma Rex