From d6548d9810aef37d92fac4f51fbe47882407e6d4 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Fri, 12 Feb 2010 15:05:48 +0000 Subject: net.dns: Normalize records before placing them in the cache, fixes issues with CNAME targets in CAPS (fixes #161) --- net/dns.lua | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'net') diff --git a/net/dns.lua b/net/dns.lua index 9cd378b2..ca5f3c62 100644 --- a/net/dns.lua +++ b/net/dns.lua @@ -594,17 +594,18 @@ end function resolver:remember(rr, type) -- - - - - - - - - - - - - - remember --print ('remember', type, rr.class, rr.type, rr.name) + local qname, qtype, qclass = standardize(rr.name, rr.type, rr.class); if type ~= '*' then - type = rr.type; - local all = get(self.cache, rr.class, '*', rr.name); + type = qtype; + local all = get(self.cache, qclass, '*', qname); --print('remember all', all); if all then append(all, rr); end end self.cache = self.cache or setmetatable({}, cache_metatable); - local rrs = get(self.cache, rr.class, type, rr.name) or - set(self.cache, rr.class, type, rr.name, setmetatable({}, rrs_metatable)); + local rrs = get(self.cache, qclass, type, qname) or + set(self.cache, qclass, type, qname, setmetatable({}, rrs_metatable)); append(rrs, rr); if type == 'MX' then self.unsorted[rrs] = true; end -- cgit v1.2.3