Project

General

Profile

Bug #28756

URI.host does not unwrap IPv6 bracket notation

Added by Lukas Zapletal almost 2 years ago. Updated almost 2 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Difficulty:
Triaged:
No
Bugzilla link:
Pull request:
Fixed in Releases:
Found in Releases:

Description

URI implementation in Ruby does not convert IPv6 bracket notation to plain IPv6 address, in other words it does not remove those brackets. We often use URI class to parse input and then uri.host is used to construct other URI/URL or directly connect to hostname/IP. This will fail if the URI had IPv6 notation. This behavior will not be changed in ruby as discussed in https://bugs.ruby-lang.org/issues/3788 and new method called "hostname" was introduced instead to unwrap IPv6 brackets:

> u = URI.parse("http://[fd00:aaaa:bbbb:cc::1]:8888")
=> #<URI::HTTP http://[fd00:aaaa:bbbb:cc::1]:8888>
> u.host
=> "[fd00:aaaa:bbbb:cc::1]" 
> u.hostname
=> "fd00:aaaa:bbbb:cc::1" 

We need to replace all "uri.host" to "uri.hostname" in Foreman, Katello and other plugins.


Related issues

Related to Foreman - Tracker #28683: IPv6 only supportNew

History

#1 Updated by Lukas Zapletal almost 2 years ago

#2 Updated by Lukas Zapletal almost 2 years ago

WORKAROUND for IPv6 testing: Do not use IPv6 address but a DNS/hostname instead for proxy.

Also available in: Atom PDF