Software /
code /
prosody
Comparison
net/dns.lua @ 7061:eda0feeaf759
Merge 0.9->0.10
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 08 Jan 2016 16:16:08 +0100 |
parent | 6866:abff7543b79c |
parent | 7059:7ec52755622f |
child | 7098:5286e79c6829 |
comparison
equal
deleted
inserted
replaced
7050:ae044691de0f | 7061:eda0feeaf759 |
---|---|
589 else -- posix | 589 else -- posix |
590 local resolv_conf = io.open("/etc/resolv.conf"); | 590 local resolv_conf = io.open("/etc/resolv.conf"); |
591 if resolv_conf then | 591 if resolv_conf then |
592 for line in resolv_conf:lines() do | 592 for line in resolv_conf:lines() do |
593 line = line:gsub("#.*$", "") | 593 line = line:gsub("#.*$", "") |
594 :match('^%s*nameserver%s+([%x:%.]*)%s*$'); | 594 :match('^%s*nameserver%s+([%x:%.]*%%?%S*)%s*$'); |
595 if line then | 595 if line then |
596 local ip = new_ip(line); | 596 local ip = new_ip(line); |
597 if ip then | 597 if ip then |
598 self:addnameserver(ip.addr); | 598 self:addnameserver(ip.addr); |
599 end | 599 end |
851 and self.active[response.header.id][response.question.raw] then | 851 and self.active[response.header.id][response.question.raw] then |
852 --print('received response'); | 852 --print('received response'); |
853 --self.print(response); | 853 --self.print(response); |
854 | 854 |
855 for j,rr in pairs(response.answer) do | 855 for j,rr in pairs(response.answer) do |
856 self:remember(rr, response.question[1].type) | 856 if rr.name:sub(-#response.question[1].name, -1) == response.question[1].name then |
857 self:remember(rr, response.question[1].type) | |
858 end | |
857 end | 859 end |
858 | 860 |
859 -- retire the query | 861 -- retire the query |
860 local queries = self.active[response.header.id]; | 862 local queries = self.active[response.header.id]; |
861 queries[response.question.raw] = nil; | 863 queries[response.question.raw] = nil; |