mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib/resolv.rb (Resolv::DNS::Resource::TXT): multiple strings was not
handled. (Resolv::DNS::Resource::TXT#strings): new method to return all strings. (Resolv::DNS::Message::MessageEncoder#put_string_list): new method. (Resolv::DNS::Message::MessageDecoder#get_string_list): ditto. based on [ruby-talk:129732] by Sam Roberts. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7890 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
7adb25643e
commit
8971dafa8d
2 changed files with 34 additions and 6 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
||||||
|
Sun Feb 6 03:24:20 2005 Tanaka Akira <akr@m17n.org>
|
||||||
|
|
||||||
|
* lib/resolv.rb (Resolv::DNS::Resource::TXT): multiple strings was not
|
||||||
|
handled.
|
||||||
|
(Resolv::DNS::Resource::TXT#strings): new method to return all
|
||||||
|
strings.
|
||||||
|
(Resolv::DNS::Message::MessageEncoder#put_string_list): new method.
|
||||||
|
(Resolv::DNS::Message::MessageDecoder#get_string_list): ditto.
|
||||||
|
based on [ruby-talk:129732] by Sam Roberts.
|
||||||
|
|
||||||
Sat Feb 5 02:24:06 2005 Minero Aoki <aamine@loveruby.net>
|
Sat Feb 5 02:24:06 2005 Minero Aoki <aamine@loveruby.net>
|
||||||
|
|
||||||
* test/ripper/test_scanner_events.rb: fix test.
|
* test/ripper/test_scanner_events.rb: fix test.
|
||||||
|
|
|
@ -1154,6 +1154,12 @@ class Resolv
|
||||||
@data << d
|
@data << d
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def put_string_list(ds)
|
||||||
|
ds.each {|d|
|
||||||
|
self.put_string(d)
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
def put_name(d)
|
def put_name(d)
|
||||||
put_labels(d.to_a)
|
put_labels(d.to_a)
|
||||||
end
|
end
|
||||||
|
@ -1266,6 +1272,14 @@ class Resolv
|
||||||
return d
|
return d
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def get_string_list
|
||||||
|
strings = []
|
||||||
|
while @index < @limit
|
||||||
|
strings << self.get_string
|
||||||
|
end
|
||||||
|
strings
|
||||||
|
end
|
||||||
|
|
||||||
def get_name
|
def get_name
|
||||||
return Name.new(self.get_labels)
|
return Name.new(self.get_labels)
|
||||||
end
|
end
|
||||||
|
@ -1508,18 +1522,22 @@ class Resolv
|
||||||
class TXT < Resource
|
class TXT < Resource
|
||||||
TypeValue = 16
|
TypeValue = 16
|
||||||
|
|
||||||
def initialize(data)
|
def initialize(first_string, *rest_strings)
|
||||||
@data = data
|
@strings = [first_string, *rest_strings]
|
||||||
|
end
|
||||||
|
attr_reader :strings
|
||||||
|
|
||||||
|
def data
|
||||||
|
@strings[0]
|
||||||
end
|
end
|
||||||
attr_reader :data
|
|
||||||
|
|
||||||
def encode_rdata(msg)
|
def encode_rdata(msg)
|
||||||
msg.put_string(@data)
|
msg.put_string_list(@strings)
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.decode_rdata(msg)
|
def self.decode_rdata(msg)
|
||||||
data = msg.get_string
|
strings = msg.get_string_list
|
||||||
return self.new(data)
|
return self.new(*strings)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue