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] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60275 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
926103a958
commit
db590b5d59
@ -2603,7 +2603,7 @@ class Resolv
|
|||||||
def each_address(name)
|
def each_address(name)
|
||||||
name = Resolv::DNS::Name.create(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)
|
super(name)
|
||||||
end
|
end
|
||||||
|
18
test/resolv/test_mdns.rb
Normal file
18
test/resolv/test_mdns.rb
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
# 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
|
Loading…
x
Reference in New Issue
Block a user