ruby-changes:48161
From: hsbt <ko1@a...>
Date: Sat, 21 Oct 2017 22:58:35 +0900 (JST)
Subject: [ruby-changes:48161] hsbt:r60275 (trunk): Fixed unexpected behavior of `Resolv::MDNS#each_address` when given ".local" address.
hsbt 2017-10-21 22:58:31 +0900 (Sat, 21 Oct 2017) New Revision: 60275 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=60275 Log: Fixed unexpected behavior of `Resolv::MDNS#each_address` when given ".local" address. https://github.com/ruby/ruby/pull/1425 Patch by @elct9620 [fix GH-1484] Added files: trunk/test/resolv/test_mdns.rb Modified files: trunk/lib/resolv.rb Index: test/resolv/test_mdns.rb =================================================================== --- test/resolv/test_mdns.rb (nonexistent) +++ test/resolv/test_mdns.rb (revision 60275) @@ -0,0 +1,18 @@ https://github.com/ruby/ruby/blob/trunk/test/resolv/test_mdns.rb#L1 +# frozen_string_literal: false +require 'test/unit' +require 'resolv' + +class TestResolvMDNS < Test::Unit::TestCase + def setup + end + + def test_mdns_each_address + mdns = Resolv::MDNS.new + mdns.each_resource '_http._tcp.local', Resolv::DNS::Resource::IN::PTR do |r| + srv = mdns.getresource r.name, Resolv::DNS::Resource::IN::SRV + mdns.each_address(srv.target) do |result| + assert_not_nil(result) + end + end + end +end Index: lib/resolv.rb =================================================================== --- lib/resolv.rb (revision 60274) +++ lib/resolv.rb (revision 60275) @@ -2603,7 +2603,7 @@ class Resolv https://github.com/ruby/ruby/blob/trunk/lib/resolv.rb#L2603 def each_address(name) name = Resolv::DNS::Name.create(name) - return unless name.to_a.last == 'local' + return unless name.to_a.last.to_s == 'local' super(name) end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/