From e15a4b15085441ec776b538a3eab2febcb8900aa Mon Sep 17 00:00:00 2001 From: Miek Gieben Date: Sat, 22 Jun 2013 09:26:20 +0100 Subject: [PATCH] Dont downcase when doing IsSubDomain, let the caller decide --- defaults.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/defaults.go b/defaults.go index 1b870808..0009a1c3 100644 --- a/defaults.go +++ b/defaults.go @@ -7,7 +7,6 @@ package dns import ( "net" "strconv" - "strings" ) const hexDigit = "0123456789abcdef" @@ -233,10 +232,11 @@ func IsDomainName(s string) (uint8, uint8, bool) { // copied from net package. return labels, uint8(l - longer), ok } -// IsSubDomain checks if child is indeed a child of the parent. +// IsSubDomain checks if child is indeed a child of the parent. Both child and +// parent are *not* downcased before doing the comparison. func IsSubDomain(parent, child string) bool { // Entire child is contained in parent - return CompareDomainName(strings.ToLower(parent), strings.ToLower(child)) == CountLabel(parent) + return CompareDomainName(parent, child) == CountLabel(parent) } // IsFqdn checks if a domain name is fully qualified.