From: Josh Cheek Date: 2012-04-01T23:28:44+09:00 Subject: Re: Can't open url with a subdomain with an underscore --e89a8f3bb0cfb5f92604bc9ee352 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 2012/3/31 Bartosz Dziewo=C5=84ski > Well, you could also copy the patched URI::Parser#initialize_pattern > method to all your files that need it. (Just make sure to require > 'uri' first, and monkeypatch later.) Like this: > > require 'uri' > class URI::Parser > def initialize_pattern(opts =3D {}) > > end > end > > There is no other way to do it, without rewriting the entire URI > library from scratch. (And that would be stupid, even more so since > the way you want it to work is technically invalid.) > > -- Matma Rex > > I feel like there's probably a better way than this, but man this lib really confuses me. require 'open-uri' URI::Parser.new(:HOSTNAME =3D> "(?:[_a-zA-Z0-9\\-.]|%\\h\\h)+").parse(" http://auto_diversen.marktplaza.nl/").open.read --e89a8f3bb0cfb5f92604bc9ee352 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 2012/3/31 Bartosz Dziewo=C5=84ski <matma.rex@gmail.com>
Well, you could also copy the patched URI::Parser#initialize_pattern
method to all your files that need it. (Just make sure to require
'uri' first, and monkeypatch later.) Like this:

require 'uri'
class URI::Parser
=C2=A0def initialize_pattern(opts =3D {})
=C2=A0 =C2=A0<snip...>
=C2=A0end
end

There is no other way to do it, without rewriting the entire URI
library from scratch. (And that would be stupid, even more so since
the way you want it to work is technically invalid.)

-- Matma Rex


I feel like there's probably a better way t= han this, but man this lib really confuses me.

req= uire 'open-uri'
URI::Parser.new(:HOSTNAME =3D> "(= ?:[_a-zA-Z0-9\\-.]|%\\h\\h)+").parse("http://auto_diversen.marktplaza.nl/").open.re= ad

--e89a8f3bb0cfb5f92604bc9ee352--