From a0325ea70402a11c3d04cafd43753344bb2648c7 Mon Sep 17 00:00:00 2001 From: nobu Date: Tue, 30 Dec 2014 07:03:47 +0000 Subject: resolv.rb: dots differences * lib/resolv.rb (Resolv::DNS::Name): names with different dots should be different. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49071 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ lib/resolv.rb | 3 ++- test/resolv/test_dns.rb | 6 ++++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index d676d385c6..4452bb2f1c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Tue Dec 30 16:03:45 2014 Nobuyoshi Nakada + + * lib/resolv.rb (Resolv::DNS::Name): names with different dots + should be different. + Tue Dec 30 13:16:56 2014 Martin Duerst * lib/uri/common.rb: Initialize HTML5ASCIIINCOMPAT to empty Array diff --git a/lib/resolv.rb b/lib/resolv.rb index c19aeacd05..f6971bf500 100644 --- a/lib/resolv.rb +++ b/lib/resolv.rb @@ -1236,7 +1236,8 @@ class Resolv def ==(other) # :nodoc: return false unless Name === other - return @labels.join == other.to_a.join && @absolute == other.absolute? + return @labels.join('.') == other.to_a.join('.') && + @absolute == other.absolute? end alias eql? == # :nodoc: diff --git a/test/resolv/test_dns.rb b/test/resolv/test_dns.rb index 8334622410..00e5142272 100644 --- a/test/resolv/test_dns.rb +++ b/test/resolv/test_dns.rb @@ -177,4 +177,10 @@ class TestResolvDNS < Test::Unit::TestCase end end end + + def test_case_insensitive_name + name1 = Resolv::DNS::Name.create("example.org") + name2 = Resolv::DNS::Name.create("ex.ampl.eo.rg") + assert_not_equal(name1, name2, "different dots") + end end -- cgit v1.2.3