|
37 | 37 |
|
38 | 38 | class Resolv |
39 | 39 |
|
| 40 | + VERSION = "0.2.2" |
| 41 | + |
40 | 42 | ## |
41 | 43 | # Looks up the first IP address for +name+. |
42 | 44 |
|
@@ -198,7 +200,7 @@ def lazy_initialize # :nodoc: |
198 | 200 | next unless addr |
199 | 201 | @addr2name[addr] = [] unless @addr2name.include? addr |
200 | 202 | @addr2name[addr] << hostname |
201 | | - @addr2name[addr] += aliases |
| 203 | + @addr2name[addr].concat(aliases) |
202 | 204 | @name2addr[hostname] = [] unless @name2addr.include? hostname |
203 | 205 | @name2addr[hostname] << addr |
204 | 206 | aliases.each {|n| |
@@ -969,7 +971,7 @@ def Config.parse_resolv_conf(filename) |
969 | 971 | next unless keyword |
970 | 972 | case keyword |
971 | 973 | when 'nameserver' |
972 | | - nameserver += args |
| 974 | + nameserver.concat(args) |
973 | 975 | when 'domain' |
974 | 976 | next if args.empty? |
975 | 977 | search = [args[0]] |
@@ -1491,14 +1493,14 @@ def put_string_list(ds) |
1491 | 1493 | } |
1492 | 1494 | end |
1493 | 1495 |
|
1494 | | - def put_name(d) |
1495 | | - put_labels(d.to_a) |
| 1496 | + def put_name(d, compress: true) |
| 1497 | + put_labels(d.to_a, compress: compress) |
1496 | 1498 | end |
1497 | 1499 |
|
1498 | | - def put_labels(d) |
| 1500 | + def put_labels(d, compress: true) |
1499 | 1501 | d.each_index {|i| |
1500 | 1502 | domain = d[i..-1] |
1501 | | - if idx = @names[domain] |
| 1503 | + if compress && idx = @names[domain] |
1502 | 1504 | self.put_pack("n", 0xc000 | idx) |
1503 | 1505 | return |
1504 | 1506 | else |
@@ -2332,7 +2334,7 @@ def encode_rdata(msg) # :nodoc: |
2332 | 2334 | msg.put_pack("n", @priority) |
2333 | 2335 | msg.put_pack("n", @weight) |
2334 | 2336 | msg.put_pack("n", @port) |
2335 | | - msg.put_name(@target) |
| 2337 | + msg.put_name(@target, compress: false) |
2336 | 2338 | end |
2337 | 2339 |
|
2338 | 2340 | def self.decode_rdata(msg) # :nodoc: |
|
0 commit comments