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:
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 = {})
<snip…>
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.)
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:
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 R.
I feel like there’s probably a better way than this, but man this lib
really confuses me.
W dniu 30 marca 2012 13:28 użytkownik Bartosz Dziewoński [email protected] 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:
W dniu 30 marca 2012 13:28 użytkownik Bartosz Dziewoński [email protected] 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: