From: cardoso_tiago@... Date: 2017-10-14T23:15:28+00:00 Subject: [ruby-core:83285] [Ruby trunk Bug#14016] URI IPv6 address can't be used to open socket Issue #14016 has been updated by chucke (Tiago Cardoso). Another notable inconsistency (when compared with the second example above): ```ruby uri.host = "::1" #=> URI::InvalidComponentError: bad component(expected host component): ::1 ``` ---------------------------------------- Bug #14016: URI IPv6 address can't be used to open socket https://bugs.ruby-lang.org/issues/14016#change-67243 * Author: chucke (Tiago Cardoso) * Status: Open * Priority: Normal * Assignee: * Target version: * ruby -v: 2.4.2 * Backport: 2.3: UNKNOWN, 2.4: UNKNOWN ---------------------------------------- The example occurred when trying to use IPv6 to establish communication between HTTP client and server. I first created an URI, passed it to Net::HTTP.get, and it blew with the following message: ``` SocketError: Failed to open TCP connection to [::1]:9292 (getaddrinfo: nodename nor servname provided, or not known) ``` It seems to me that the URI and the Socket classes don't play well with its expected representation of an IPv6 address: ```ruby URI::HTTP.build(host: "[::1]").host #=> "[::1]" URI::HTTP.build(host: "::1").host #=> ���[::1]��� TCPSocket.new("::1", 9292) #=> # TCPSocket.new("[::1]", 9292) #=> # ``` -- https://bugs.ruby-lang.org/ Unsubscribe: