aboutsummaryrefslogtreecommitdiffstats
path: root/net/dns.lua
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
commit8e47276e919b4bd9b50916c9831e96158c0eeb4f (patch)
tree35d429ad8c55e55deecb658a18cd18be7c178b52 /net/dns.lua
parentf3444ceaa2a879e7823bd772791bc7c31dc61075 (diff)
downloadprosody-8e47276e919b4bd9b50916c9831e96158c0eeb4f.tar.gz
prosody-8e47276e919b4bd9b50916c9831e96158c0eeb4f.zip
net.dns: Normalize records before placing them in the cache, fixes issues with CNAME targets in CAPS (fixes #161)
Diffstat (limited to 'net/dns.lua')
-rw-r--r--net/dns.lua9
1 files changed, 5 insertions, 4 deletions
diff --git a/net/dns.lua b/net/dns.lua
index c50e893c..25941015 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