1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* lib/resolv.rb: fall back if canonicalization fails.

Thanks Vit Ondruch for the patch!  [ruby-core:65836]

* test/resolv/test_dns.rb: test for patch

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48534 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
tenderlove 2014-11-21 20:04:27 +00:00
parent 8eb0c810b2
commit 570c028c7e
3 changed files with 25 additions and 0 deletions

View file

@ -1,3 +1,10 @@
Fri Nov 21 11:58:58 2014 Aaron Patterson <aaron@tenderlovemaking.com>
* lib/resolv.rb: fall back if canonicalization fails.
Thanks Vit Ondruch for the patch! [ruby-core:65836]
* test/resolv/test_dns.rb: test for patch
Sat Nov 22 01:11:53 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
* object.c (rb_mod_const_get, rb_mod_const_defined): ditto.

View file

@ -1066,6 +1066,10 @@ class Resolv
candidates = []
end
candidates.concat(@search.map {|domain| Name.new(name.to_a + domain)})
fname = Name.create("#{name}.")
if !candidates.include?(fname)
candidates << fname
end
end
return candidates
end

View file

@ -23,6 +23,20 @@ class TestResolvDNS < Test::Unit::TestCase
end
end
# [ruby-core:65836]
def test_resolve_with_2_ndots
conf = Resolv::DNS::Config.new :nameserver => ['127.0.0.1'], :ndots => 2
assert conf.single?
candidates = []
conf.resolv('example.com') { |candidate, *args|
candidates << candidate
raise Resolv::DNS::Config::NXDomain
}
n = Resolv::DNS::Name.create 'example.com.'
assert_equal n, candidates.last
end
def test_query_ipv4_address
begin
OpenSSL