Project

General

Profile

Actions

Bug #14016

closed

URI IPv6 address can't be used to open socket

Added by chucke (Tiago Cardoso) over 4 years ago. Updated over 4 years ago.

Status:
Rejected
Priority:
Normal
Assignee:
-
Target version:
-
ruby -v:
2.4.2
[ruby-core:83283]

Description

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:

URI::HTTP.build(host: "[::1]").host #=> "[::1]"
URI::HTTP.build(host: "::1").host #=> ”[::1]”
TCPSocket.new("::1", 9292) #=> #<TCPSocket fd:15>
TCPSocket.new("[::1]", 9292) #=> #<TCPSocket fd:15>
Actions

Also available in: Atom PDF