I noticed that Async::DNS::Resolver will return CNAME records when querying SRV records for a domain that maps unknown sub-domains to a catch-all alias (ex: github.com). Where as Resolv::DNS will return an empty Array since the response records do not match the requested resource type.
This could be fixed by simply filtering the response records by class.
Steps To Reproduce
require 'async/dns'
require 'resolv'
async_resolver = Async::DNS::Resolver.new([[:udp, '8.8.8.8', 53]])
Async do
response = async_resolver.query('_xmpp-server._tcp.github.com', Resolv::DNS::Resource::IN::SRV)
records = response.answer.map { |answer| answer[2] }
p records
end
resolve = Resolv::DNS.new(nameserver: %w[8.8.8.8])
records = resolve.getresources('_xmpp-server._tcp.github.com', Resolv::DNS::Resource::IN::SRV)
p records
Expected Behavior
Actual Behavior
[#<Resolv::DNS::Resource::IN::CNAME:0x00007f4027885400 @name=#<Resolv::DNS::Name: github.github.io.>, @ttl=3499>]
[]
Additional Information
- ruby 3.1.4p223 (2023-03-30 revision 957bb7cb81) [x86_64-linux]
- async-dns (1.3.0)