Bug #3788: URI cannot parse IPv6 addresses propertly
http://redmine.ruby-lang.org/issues/show/3788

Author: Adam Majer
Status: Open, Priority: Normal
ruby -v: ruby 1.9.1p378 (2010-01-10 revision 26273) [x86_64-linux]

require 'uri'

u = URI::parse( 'http://[::1]:8080/test' )
u.host
=> "[::1]"

  **** THIS SHOULD READ ::1 ****

irb(main):007:0> u.host = '127.0.0.1'
=> "127.0.0.1"
irb(main):008:0> u.host = '::1'
URI::InvalidComponentError: bad component(expected host component): ::1
        from /usr/lib/ruby/1.9.1/uri/generic.rb:388:in `check_host'
        from /usr/lib/ruby/1.9.1/uri/generic.rb:402:in `host='
        from (irb):8
        from /usr/bin/irb1.9.1:12:in `<main>'
irb(main):009:0> u.host = 'localhost'
=> "localhost"


If settings host to ::1 doesn't work, then setting it to [::1] should produce ::1 hostname. [::1] clearly would not resolve and hostnames should resolve.


----------------------------------------
http://redmine.ruby-lang.org