Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1298282

Summary: Fix IPv6 addresses in URIs with Net::HTTP
Product: Red Hat Enterprise Linux 7 Reporter: Tomas Jelinek <tojeline>
Component: rubyAssignee: Pavel Valena <pvalena>
Status: CLOSED ERRATA QA Contact: Iveta Wiedermann <isenfeld>
Severity: high Docs Contact:
Priority: high    
Version: 7.2CC: fdinitto, hhorak, isenfeld, ovasik, pvalena, rsteiger, toneata
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: ruby-2.0.0.648-26.el7 Doc Type: No Doc Update
Doc Text:
undefined
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-11-04 06:16:24 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1289025, 1295829, 1313485    

Description Tomas Jelinek 2016-01-13 16:18:04 UTC
Description of problem:
There is a bug in ruby stdlib Net::HTTP class which prevents connecting to hosts using IPv6.


Version-Release number of selected component (if applicable):
[root@rh72-node1:~]# ruby -v
ruby 2.0.0p598 (2014-11-13) [x86_64-linux]
[root@rh72-node1:~]# rpm -q ruby
ruby-2.0.0.598-25.el7_1.x86_64


How reproducible:
easily, always


Steps to Reproduce:
[root@rh72-node1:~]# irb
irb(main):001:0> require 'net/http'
=> true
irb(main):002:0> myhttp = Net::HTTP.new("::1")
=> #<Net::HTTP ::1:80 open=false>
irb(main):003:0> myhttp.start
URI::InvalidURIError: the scheme http does not accept registry part: ::1:80 (or bad hostname?)
        from /usr/share/ruby/uri/generic.rb:214:in `initialize'
        from /usr/share/ruby/uri/http.rb:84:in `initialize'
        from /usr/share/ruby/uri/common.rb:214:in `new'
        from /usr/share/ruby/uri/common.rb:214:in `parse'
        from /usr/share/ruby/uri/common.rb:747:in `parse'
        from /usr/share/ruby/uri/common.rb:996:in `URI'
        from /usr/share/ruby/net/http.rb:1027:in `proxy_uri'
        from /usr/share/ruby/net/http.rb:1014:in `proxy?'
        from /usr/share/ruby/net/http.rb:868:in `connect'
        from /usr/share/ruby/net/http.rb:862:in `do_start'
        from /usr/share/ruby/net/http.rb:857:in `start'
        from (irb):3
        from /usr/bin/irb:12:in `<main>'
irb(main):004:0> myhttp = Net::HTTP.new("[::1]")
=> #<Net::HTTP [::1]:80 open=false>
irb(main):005:0> myhttp.start
SocketError: getaddrinfo: Name or service not known
        from /usr/share/ruby/net/http.rb:878:in `initialize'
        from /usr/share/ruby/net/http.rb:878:in `open'
        from /usr/share/ruby/net/http.rb:878:in `block in connect'
        from /usr/share/ruby/timeout.rb:52:in `timeout'
        from /usr/share/ruby/net/http.rb:877:in `connect'
        from /usr/share/ruby/net/http.rb:862:in `do_start'
        from /usr/share/ruby/net/http.rb:857:in `start'
        from (irb):5
        from /usr/bin/irb:12:in `<main>'
irb(main):006:0>


Actual results:
Ruby does not even try to connect to localhost no matter if the address is enclosed in [] (which is wrong anyways) or not.


Expected results:
irb(main):001:0> require 'net/http'
=> true
irb(main):002:0> myhttp = Net::HTTP.new("::1")
=> #<Net::HTTP ::1:80 open=false>
irb(main):003:0> myhttp.start
Errno::ECONNREFUSED: Connection refused - connect(2) for "::1" port 80
        from /usr/share/ruby/net/http.rb:879:in `initialize'
        from /usr/share/ruby/net/http.rb:879:in `open'
        from /usr/share/ruby/net/http.rb:879:in `block in connect'
        from /usr/share/ruby/timeout.rb:73:in `timeout'
        from /usr/share/ruby/net/http.rb:878:in `connect'
        from /usr/share/ruby/net/http.rb:863:in `do_start'
        from /usr/share/ruby/net/http.rb:858:in `start'
        from (irb):3
        from /usr/bin/irb:11:in `<main>'
irb(main):004:0>

Ruby tries to connect to localhost. Since there is no HTTP server running, it gets Errno::ECONNREFUSED, that is not an issue.


Additional info:
This has been reported in upstream https://bugs.ruby-lang.org/issues/9129
and fixed as well https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=47079

Comment 2 Vít Ondruch 2016-01-14 11:23:13 UTC
This could be resolved by rebase of Ruby 2.0.0 I am proposing in bug 1197720.

Comment 7 errata-xmlrpc 2016-11-04 06:16:24 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHEA-2016-2422.html