From: Jeroen van Ingen Date: 2012-04-18T17:10:52+09:00 Subject: Re: Can't open url with a subdomain with an underscore Bartosz Dziewoński wrote in post #1057001: > W dniu 30 marca 2012 13:28 użytkownik Bartosz Dziewoński > napisał: >> Underscore is not a valid character in a hostname, thus Ruby rejects it. >> >> To allow it, you have to manually add it to the regex in library file >> uri/common.rb, line 368. (On my Windows install, >> F:\Ruby193\lib\ruby\1.9.1\uri), to looks like this: >> >>  ret[:HOSTNAME] = hostname = "(?:[a-zA-Z0-9\\-._]|%\\h\\h)+" >> >> (I just added an underscore there.) This might of course break URI >> parsing for other protocols. > > The line before editing looks like this: > > ret[:HOSTNAME] = hostname = "(?:[a-zA-Z0-9\\-.]|%\\h\\h)+" > > (I am on Ruby 1.9.3) > > -- Matma Rex I did add this line: ret[:HOSTNAME] = hostname = "(?:[a-zA-Z0-9\\-._]|%\\h\\h)+" But still getting the error URI::InvalidURIError: the scheme http does not accept registry part: auto_diversen.marktplaza.nl:80 (or bad hostname?) When executing: URI::Parser.new.parse(url).open Are you sure I only need to monkey-patch URI::Parser#initialize_pattern ? -- Posted via http://www.ruby-forum.com/.