summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorKasumi Hanazuki <kasumi@rollingapple.net>2023-04-08 12:25:04 +0000
committergit <svn-admin@ruby-lang.org>2023-04-08 14:16:59 +0000
commit957595f2182ee9002404258f5e495528f2285ed6 (patch)
tree2ad77c78c04ceb54e75f329f61df9113103b8168 /lib
parenta4cc3fcbd27494a226df20e4369f2c2d41a7bc01 (diff)
downloadruby-957595f2182ee9002404258f5e495528f2285ed6.tar.gz
[ruby/resolv] Do not compress domain name in SRV RDATA
[RFC2782] prohibits use of name compression for the target host name in the RDATA of a SRV record. [RFC2782]: https://datatracker.ietf.org/doc/rfc2782/ Closes: https://github.com/ruby/resolv/issues/29 https://github.com/ruby/resolv/commit/ac85724e17
Diffstat (limited to 'lib')
-rw-r--r--lib/resolv.rb10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/resolv.rb b/lib/resolv.rb
index 61c9c7d5cf..ff86e4337c 100644
--- a/lib/resolv.rb
+++ b/lib/resolv.rb
@@ -1487,14 +1487,14 @@ class Resolv
}
end
- def put_name(d)
- put_labels(d.to_a)
+ def put_name(d, compress: true)
+ put_labels(d.to_a, compress: compress)
end
- def put_labels(d)
+ def put_labels(d, compress: true)
d.each_index {|i|
domain = d[i..-1]
- if idx = @names[domain]
+ if compress && idx = @names[domain]
self.put_pack("n", 0xc000 | idx)
return
else
@@ -2328,7 +2328,7 @@ class Resolv
msg.put_pack("n", @priority)
msg.put_pack("n", @weight)
msg.put_pack("n", @port)
- msg.put_name(@target)
+ msg.put_name(@target, compress: false)
end
def self.decode_rdata(msg) # :nodoc: