diff --git a/src/dorkbox/network/dns/DnsQuestion.java b/src/dorkbox/network/dns/DnsQuestion.java index 87fd67cc..95899426 100644 --- a/src/dorkbox/network/dns/DnsQuestion.java +++ b/src/dorkbox/network/dns/DnsQuestion.java @@ -54,29 +54,31 @@ class DnsQuestion extends DnsMessage implements AddressedEnvelope ip address, the hostname MUST end in a dot - hostname = appendTrailingDot(hostname); - } - try { - DnsRecord questionRecord = DnsRecord.newRecord(Name.fromString(hostname), type, DnsClass.IN); + DnsRecord questionRecord = DnsRecord.newRecord(name, type, DnsClass.IN); DnsQuestion question = new DnsQuestion(isResolveQuestion); question.getHeader() .setOpcode(DnsOpCode.QUERY); @@ -92,23 +94,23 @@ class DnsQuestion extends DnsMessage implements AddressedEnvelope ip address, the hostname MUST end in a dot + if (!StringUtil.endsWith(hostName, '.')) { + return hostName + '.'; + } else { + return hostName; + } + + default: + return hostName; + } + } }