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.

-- Matma Rex