Software /
code /
prosody
Diff
net/dns.lua @ 1827:fc21e8832848
net.dns: Even better parsing of nameservers from resolv.conf
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Fri, 25 Sep 2009 01:35:46 +0100 |
parent | 1822:2f78ea5d0f11 |
child | 1836:f4c88dd32724 |
child | 1949:e3d777d76b1a |
line wrap: on
line diff
--- a/net/dns.lua Thu Sep 24 23:46:12 2009 +0100 +++ b/net/dns.lua Fri Sep 25 01:35:46 2009 +0100 @@ -510,7 +510,7 @@ local resolv_conf = io.open("/etc/resolv.conf"); if resolv_conf then for line in resolv_conf:lines() do - local address = string.match (line, '^%s*nameserver%s+(%d+%.%d+%.%d+%.%d+)%s*$') + local address = line:gsub("#.*$", ""):match('^%s*nameserver%s+(%d+%.%d+%.%d+%.%d+)%s*$') if address then self:addnameserver (address) end end elseif os.getenv("WINDIR") then