From d494a16ac5d39544b1a5b317414f27f90678a3a5 Mon Sep 17 00:00:00 2001 From: Jeremy Evans Date: Sat, 9 Jan 2021 12:14:23 -0800 Subject: [PATCH] [ruby/resolv] Support more characters in link local addresses Implements [Feature #17524] https://github.com/ruby/resolv/commit/993a1a374f --- lib/resolv.rb | 4 ++-- test/resolv/test_addr.rb | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/resolv.rb b/lib/resolv.rb index b69c7045ca..61c9c7d5cf 100644 --- a/lib/resolv.rb +++ b/lib/resolv.rb @@ -2464,7 +2464,7 @@ class Resolv Regex_8HexLinkLocal = /\A [Ff][Ee]80 (?::[0-9A-Fa-f]{1,4}){7} - %[0-9A-Za-z]+ + %[-0-9A-Za-z._~]+ \z/x ## @@ -2478,7 +2478,7 @@ class Resolv | :((?:[0-9A-Fa-f]{1,4}(?::[0-9A-Fa-f]{1,4})*)?) )? - :[0-9A-Fa-f]{1,4}%[0-9A-Za-z.]+ + :[0-9A-Fa-f]{1,4}%[-0-9A-Za-z._~]+ \z/x ## diff --git a/test/resolv/test_addr.rb b/test/resolv/test_addr.rb index 62092676ba..f701c31d3e 100644 --- a/test/resolv/test_addr.rb +++ b/test/resolv/test_addr.rb @@ -28,6 +28,10 @@ class TestResolvAddr < Test::Unit::TestCase assert_match(Resolv::IPv6::Regex, "FE80:2:3:4:5:6:7:8%EM1", bug17112) assert_match(Resolv::IPv6::Regex, "FE80::20D:3AFF:FE7D:9760%ETH0", bug17112) assert_match(Resolv::IPv6::Regex, "FE80::1%EM1", bug17112) + + bug17524 = "[ruby-core:101992]" + assert_match(Resolv::IPv6::Regex, "FE80::20D:3AFF:FE7D:9760%ruby_3.0.0-1", bug17524) + assert_match(Resolv::IPv6::Regex, "fe80::1%ruby_3.0.0-1", bug17524) end def test_valid_socket_ip_address_list