Diff

net/dns.lua @ 2082:1381b2071c2e

net.dns: Be more strict about the records we cache
author Matthew Wild <mwild1@gmail.com>
date Wed, 18 Nov 2009 01:09:09 +0000
parent 2081:b9bbb709d62e
child 2278:8c10f13c0c20
child 2762:2bddf8b766f7
child 2856:70e6ea49aff3
line wrap: on
line diff
--- a/net/dns.lua	Wed Nov 18 01:05:38 2009 +0000
+++ b/net/dns.lua	Wed Nov 18 01:09:09 2009 +0000
@@ -731,17 +731,16 @@
 					--print('received response');
 					--self.print(response);
 
-					for i,section in pairs({ 'answer', 'authority', 'additional' }) do
-						for j,rr in pairs(response[section]) do
+					for j,rr in pairs(response.answer) do
+						if rr.name:sub(-#response.question[1].name, -1) == response.question[1].name then
 							self:remember(rr, response.question[1].type)
 						end
 					end
 
 					-- retire the query
 					local queries = self.active[response.header.id];
-					if queries[response.question.raw] then
-						queries[response.question.raw] = nil;
-					end
+					queries[response.question.raw] = nil;
+					
 					if not next(queries) then self.active[response.header.id] = nil; end
 					if not next(self.active) then self:closeall(); end