Diff

net/dns.lua @ 1713:252afc358000

net.dns: Automatically add nameserver 127.0.0.1 if /etc/resolv.conf missing or empty on a non-Windows system (thanks Louis Mamakos)
author Matthew Wild <mwild1@gmail.com>
date Tue, 18 Aug 2009 13:47:21 +0100
parent 1523:841d61be198f
child 1729:2876a0ecceab
line wrap: on
line diff
--- a/net/dns.lua	Tue Aug 18 13:03:35 2009 +0100
+++ b/net/dns.lua	Tue Aug 18 13:47:21 2009 +0100
@@ -509,9 +509,12 @@
 		local address = string.match (line, 'nameserver%s+(%d+%.%d+%.%d+%.%d+)')
 		if address then  self:addnameserver (address)  end
 	  end
-  else -- FIXME correct for windows, using opendns nameservers for now
-	self:addnameserver ("208.67.222.222")
-	self:addnameserver ("208.67.220.220")
+  elseif os.getenv("WINDIR") then
+  	self:addnameserver ("208.67.222.222")
+  	self:addnameserver ("208.67.220.220")  	
+  end
+  if not self.server or #self.server == 0 then
+  	self:addnameserver("127.0.0.1");
   end
 end