summaryrefslogtreecommitdiff
path: root/test
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 /test
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 'test')
-rw-r--r--test/resolv/test_resource.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/resolv/test_resource.rb b/test/resolv/test_resource.rb
index b75cf67f31..b688155dc2 100644
--- a/test/resolv/test_resource.rb
+++ b/test/resolv/test_resource.rb
@@ -23,4 +23,12 @@ class TestResolvResource < Test::Unit::TestCase
def test_coord
Resolv::LOC::Coord.create('1 2 1.1 N')
end
+
+ def test_srv_no_compress
+ # Domain name in SRV RDATA should not be compressed
+ issue29 = 'https://github.com/ruby/resolv/issues/29'
+ m = Resolv::DNS::Message.new(0)
+ m.add_answer('example.com', 0, Resolv::DNS::Resource::IN::SRV.new(0, 0, 0, 'www.example.com'))
+ assert_equal "\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x07example\x03com\x00\x00\x21\x00\x01\x00\x00\x00\x00\x00\x17\x00\x00\x00\x00\x00\x00\x03www\x07example\x03com\x00", m.encode, issue29
+ end
end