Changeset

8900:fcf42bd7d067

net.dns: Don't attempt to cache unparsed data (fixes #1056) rr[qtype:lower()] can be nil. I think this happens if the type does not have a parser. Also see #819 #976
author Kim Alvefur <zash@zash.se>
date Sat, 09 Jun 2018 15:35:03 +0200
parents 8899:c72a6226ee31
children 8901:eae606b9266c
files net/dns.lua
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/net/dns.lua	Sat Jun 09 00:09:25 2018 +0200
+++ b/net/dns.lua	Sat Jun 09 15:35:03 2018 +0200
@@ -672,7 +672,7 @@
 	self.cache = self.cache or setmetatable({}, cache_metatable);
 	local rrs = get(self.cache, qclass, type, qname) or
 		set(self.cache, qclass, type, qname, setmetatable({}, rrs_metatable));
-	if not rrs[rr[qtype:lower()]] then
+	if rr[qtype:lower()] and not rrs[rr[qtype:lower()]] then
 		rrs[rr[qtype:lower()]] = true;
 		append(rrs, rr);
 	end