* lib/resolv.rb (Resolv::DNS::Label::Str#==): Check class equality.
(Resolv::DNS::Name#initialize): Normalize labels as Resolv::DNS::Label::Str objects. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49095 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
31d24fae56
commit
ec7f1f5dc2
@ -1,3 +1,9 @@
|
|||||||
|
Fri Jan 2 09:08:31 2015 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
|
* lib/resolv.rb (Resolv::DNS::Label::Str#==): Check class equality.
|
||||||
|
(Resolv::DNS::Name#initialize): Normalize labels as
|
||||||
|
Resolv::DNS::Label::Str objects.
|
||||||
|
|
||||||
Thu Jan 1 21:41:49 2015 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
|
Thu Jan 1 21:41:49 2015 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
|
||||||
|
|
||||||
* doc/regexp.rdoc: fix regexp docs for whitespace character.
|
* doc/regexp.rdoc: fix regexp docs for whitespace character.
|
||||||
|
@ -1185,7 +1185,7 @@ class Resolv
|
|||||||
end
|
end
|
||||||
|
|
||||||
def ==(other)
|
def ==(other)
|
||||||
return @downcase == other.downcase
|
return self.class == other.class && @downcase == other.downcase
|
||||||
end
|
end
|
||||||
|
|
||||||
def eql?(other)
|
def eql?(other)
|
||||||
@ -1221,6 +1221,14 @@ class Resolv
|
|||||||
end
|
end
|
||||||
|
|
||||||
def initialize(labels, absolute=true) # :nodoc:
|
def initialize(labels, absolute=true) # :nodoc:
|
||||||
|
labels = labels.map {|label|
|
||||||
|
case label
|
||||||
|
when String then Label::Str.new(label)
|
||||||
|
when Label::Str then label
|
||||||
|
else
|
||||||
|
raise ArgumentError, "unexpected label: #{label.inspect}"
|
||||||
|
end
|
||||||
|
}
|
||||||
@labels = labels
|
@labels = labels
|
||||||
@absolute = absolute
|
@absolute = absolute
|
||||||
end
|
end
|
||||||
|
@ -190,4 +190,11 @@ class TestResolvDNS < Test::Unit::TestCase
|
|||||||
upper = Resolv::DNS::Name.create("Ruby-Lang.org")
|
upper = Resolv::DNS::Name.create("Ruby-Lang.org")
|
||||||
assert_equal(lower, upper, bug10550)
|
assert_equal(lower, upper, bug10550)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_ipv6_name
|
||||||
|
addr = Resolv::IPv6.new("\0"*16)
|
||||||
|
labels = addr.to_name.to_a
|
||||||
|
expected = (['0'] * 32 + ['ip6', 'arpa']).map {|label| Resolv::DNS::Label::Str.new(label) }
|
||||||
|
assert_equal(expected, labels)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user