aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2010-02-12 15:05:48 +0000
committerMatthew Wild <mwild1@gmail.com>2010-02-12 15:05:48 +0000
commitd6548d9810aef37d92fac4f51fbe47882407e6d4 (patch)
treed9c7014b800f5ebad269dc679e5daa35d1c9370e /net
parent706c63594e219134ab74b2f8195af32e8bbc534d (diff)
downloadprosody-d6548d9810aef37d92fac4f51fbe47882407e6d4.tar.gz
prosody-d6548d9810aef37d92fac4f51fbe47882407e6d4.zip
net.dns: Normalize records before placing them in the cache, fixes issues with CNAME targets in CAPS (fixes #161)
Diffstat (limited to 'net')
-rw-r--r--net/dns.lua9
1 files changed, 5 insertions, 4 deletions
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