From: noreply@... Date: 2005-05-10T11:10:41+09:00 Subject: [ ruby-Bugs-1890 ] URI.parse fails to encode/decode IPv6 addresses Bugs item #1890, was opened at 2005-05-09 22:03 You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=1698&aid=1890&group_id=426 Category: Standard Library Group: None Status: Open Resolution: None Priority: 5 Submitted By: Sam Roberts (sam) Assigned to: Nobody (None) Summary: URI.parse fails to encode/decode IPv6 addresses Initial Comment: irb(main):002:0> URI.parse("http://[::1]").host => "[::1]" irb(main):003:0> Socket.getaddrinfo("[::1]", nil) SocketError: getaddrinfo: No address associated with nodename from (irb):3:in `getaddrinfo' from (irb):3 I think that URI should remove the [] from the host part when it parses, and add it back in when it builds. I see this problem propogates itself up through net/http, open-uri, etc... None of these APIs seem to accept IPv6 URIs (at least not ::1, loopback, the only one I can connect to). It also won't encode IPv6 addresses: URI::HTTP.build(:scheme => 'http', :host => '::1').to_s URI::InvalidComponentError: bad component(expected host component): ::1 from /usr/local/lib/ruby/1.8/uri/generic.rb:380:in `check_host' ... This works: URI::HTTP.build(:scheme => 'http', :host => '[::1]').to_s) => "http://[::1]" But it's URI's job to know the IPv6 URI syntax, not mine! ---------------------------------------------------------------------- You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=1698&aid=1890&group_id=426