Skip to content

Instantly share code, notes, and snippets.

@mcr
Created February 9, 2018 01:35
Show Gist options
  • Save mcr/a0e003af6d3e400a7553543c19da8b95 to your computer and use it in GitHub Desktop.
Save mcr/a0e003af6d3e400a7553543c19da8b95 to your computer and use it in GitHub Desktop.
IPv6 literals vs URI and Addrinfo
Either URI should be removing the [], or Addrinfo should be accepting it. Given that Addrinfo is just getaddrinfo(3), and it does not peel off the [], I think the fault is URI.
2.4.1 :007 > n = URI.parse("https://[::2]:1234/")
=> #<URI::HTTPS https://[::2]:1234/>
2.4.1 :008 > Addrinfo.udp(n.host, n.port)
SocketError: getaddrinfo: Name or service not known
2.4.1 :009 > n = URI.parse("coaps://[::2]:5684/")
=> #<URI::Generic coaps://[::2]:5684/>
2.4.1 :010 > Addrinfo.udp(n.host, n.port)
SocketError: getaddrinfo: Name or service not known
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment