netty5/codec-dns/src/test/java/io/netty/handler/codec/dns
Trustin Lee 4b38b72a0d Fix incorrect name encoding/decoding in DNS records
Motivation:

- The decoded name should always end with a dot (.), but we currently
  strip it, which is incorrect.
  - (O) 0 -> "."
  - (X) 0 -> ""
  - (O) 5 netty 2 io 0 -> "netty.io."
  - (X) 5 netty 2 io 0 -> "netty.io"
- The encoded name should end with a null-label, which is a label whose
  length is 0, but we currently append an extra NUL, causing FORMERR(1)
  on a strict DNS server:
  - (O) . -> 0
  - (X) . -> 0 0
  - (O) netty.io. -> 5 netty 2 io 0
  - (X) netty.io. -> 5 netty 2 io 0 0

Modifications:

- Make sure to append '.' when decoding a name.
- Improve index checks so that the decoder can raise
  CorruptFrameException instead of IIOBE
- Do not encode extra NUL
- Add more tests

Result:

Robustness and correctness
2016-04-01 22:18:33 +02:00
..
AbstractDnsRecordTest.java [#4993] Correctly handle trailing dot in DNS requests and responses for the hostname. 2016-03-22 12:30:46 +01:00
DefaultDnsRecordDecoderTest.java Fix incorrect name encoding/decoding in DNS records 2016-04-01 22:18:33 +02:00
DefaultDnsRecordEncoderTest.java Fix incorrect name encoding/decoding in DNS records 2016-04-01 22:18:33 +02:00
DnsQueryTest.java Fix a test failure in DnsQueryTest 2015-05-01 12:03:44 +09:00
DnsRecordTypeTest.java Revamp DNS codec 2015-05-01 11:33:16 +09:00
DnsResponseTest.java Revamp DNS codec 2015-05-01 11:33:16 +09:00