Comparison

net/dns.lua @ 1836:f4c88dd32724

Merge with 0.5
author Matthew Wild <mwild1@gmail.com>
date Sun, 27 Sep 2009 12:26:51 +0100
parent 1823:7c3ec7ac6316
parent 1827:fc21e8832848
child 1950:a1d186c8c65a
comparison
equal deleted inserted replaced
1823:7c3ec7ac6316 1836:f4c88dd32724
508 508
509 function resolver:adddefaultnameservers () -- - - - - adddefaultnameservers 509 function resolver:adddefaultnameservers () -- - - - - adddefaultnameservers
510 local resolv_conf = io.open("/etc/resolv.conf"); 510 local resolv_conf = io.open("/etc/resolv.conf");
511 if resolv_conf then 511 if resolv_conf then
512 for line in resolv_conf:lines() do 512 for line in resolv_conf:lines() do
513 local address = string.match (line, '^%s*nameserver%s+(%d+%.%d+%.%d+%.%d+)%s*$') 513 local address = line:gsub("#.*$", ""):match('^%s*nameserver%s+(%d+%.%d+%.%d+%.%d+)%s*$')
514 if address then self:addnameserver (address) end 514 if address then self:addnameserver (address) end
515 end 515 end
516 elseif os.getenv("WINDIR") then 516 elseif os.getenv("WINDIR") then
517 self:addnameserver ("208.67.222.222") 517 self:addnameserver ("208.67.222.222")
518 self:addnameserver ("208.67.220.220") 518 self:addnameserver ("208.67.220.220")