Issue #12642 has been updated by anuraguniyal (anurag uniyal).


Is there a workaround for this? How should we connect to ipv6 servers?

----------------------------------------
Bug #12642: Net::HTTP populates host header incorrectly when using an IPv6 Address
https://bugs.ruby-lang.org/issues/12642#change-65251

* Author: dcorbin (David Corbin)
* Status: Assigned
* Priority: Normal
* Assignee: naruse (Yui NARUSE)
* Target version: 
* ruby -v: 
* Backport: 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN
----------------------------------------
When sending a request, the client code adds a "Host" header.  It does the by taking the given address, appending a colon, and then appending the port.  This creates a fragment of a URL such as "google.com:80".  However, when instead of "google.com", the address is an IPv6 address is given (such as 8383:3223::1333:DE12), simply appending a colon is not adequate.   It yields 8383:3223::1333:DE12:80, which is hard to parse mess. 

RFC3986 stipulates that the host should be surrounded by square brackets, which would have the Host header as: [8383:3223::1333:DE12]:80.

---Files--------------------------------
ipv6_test.rb (1.17 KB)


-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>