URI.parse() will not parse a URI containing a non-qualified hostname that begins with a number. An IRB session:
irb(main):001:0> require 'uri'
=> true
irb(main):002:0> URI.parse("http://threebee")
=> #<URI::HTTP:0x161319e URL:http://threebee>
irb(main):003:0> URI.parse("http://3bee")
URI::InvalidURIError: the scheme http does not accept registry part: 3bee (or bad hostname?)
from c:/p4/tableau-3-5/workgroup-support/ruby/lib/ruby/1.8/uri/generic.rb:194:in `initialize'
from c:/p4/tableau-3-5/workgroup-support/ruby/lib/ruby/1.8/uri/http.rb:46:in `initialize'
from c:/p4/tableau-3-5/workgroup-support/ruby/lib/ruby/1.8/uri/common.rb:484:in `new'
from c:/p4/tableau-3-5/workgroup-support/ruby/lib/ruby/1.8/uri/common.rb:484:in `parse'
from (irb):3
from ♥:0
irb(main):004:0> URI.parse("http://3bee.foo.com")
=> #<URI::HTTP:0x16108fe URL:http://3bee.foo.com>
Note that the qualified form parses correctly, suggesting that the hostname is acceptable.
A discussion of this case can be found in ruby-talk, archived here:
http://blade.nagaokaut.ac.jp/cgi-bin/vframe.rb/ruby/ruby-talk/266700?266598-266714
|