Issue #10911 has been updated by Dan0042 (Daniel DeLorme).
Looks like this testcase was in the original IPAddr commit from 2002:
```
commit 9ec0a96ad4235f2054976eab6c04efbe62b3c703
Author: knu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>
Date: Mon Dec 23 17:07:49 2002 +0000
* MANIFEST, lib/README, lib/ipaddr.rb: Add ipaddr.rb from rough.
```
Maybe @knu remembers why?
But I think this could break the contract in other places that accept a IPv6 address but not a zone identifier. ex:
```ruby
Socket.getaddrinfo("fe80::1%fxp0", nil) #=> SocketError (getaddrinfo: Name or service not known)
Socket.getaddrinfo("fe80::1", nil) #=> [["AF_INET6", 0, "fe80::1", "fe80::1", 10, 1, 6], ["AF_INET6", 0, "fe80::1", "fe80::1", 10, 2, 17], ["AF_INET6", 0, "fe80::1", "fe80::1", 10, 3, 0]]
TCPSocket.new("fe80::1%fxp0", 42) #=> SocketError (getaddrinfo: Name or service not known)
TCPSocket.new("fe80::1", 42) #=> Errno::EINVAL (Invalid argument - connect(2) for "fe80::1" port 42)
```
So "fe80::1%fxp0" is not even recognized as an IP address. This could result in unpleasantness in cases like this:
```ruby
str = "fe80::1%fxp0"
ip = IPAddr.new(str) rescue nil #validate IP address
TCPSocket.new(ip.to_s, 42) if ip #and connect
```
----------------------------------------
Feature #10911: IPAddr.new should ignore zone identifiers
https://bugs.ruby-lang.org/issues/10911#change-82405
* Author: postmodern (Hal Brodigan)
* Status: Assigned
* Priority: Normal
* Assignee: knu (Akinori MUSHA)
* Target version:
----------------------------------------
Link local IPv6 addresses may have a zone identifier suffix:
fe80::1%lo0
IPAddr.new currently does not ignore the zone identifier and raises IPAddr::InvalidAddressError.
---Files--------------------------------
ipaddr-ipv6-zone-id-10911.patch (5.17 KB)
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:[email protected]?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>