Skip to content
This repository has been archived by the owner on Jul 11, 2023. It is now read-only.

Commit

Permalink
fix(client) always inject localhost
Browse files Browse the repository at this point in the history
Treat the localhost name special by always injection it, according
to RFC 6761: Section 6.3.3

fixes #50
  • Loading branch information
Tieske committed Aug 23, 2018
1 parent 3422f16 commit 299d01c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/resty/dns/client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,14 @@ _M.init = function(options)
hosts = {}
end

-- treat `localhost` special, by always defining it, RFC 6761: Section 6.3.3
if not hosts.localhost then
hosts.localxxxhost = {
ipv4 = "127.0.0.1",
ipv6 = "[::1]",
}
end

-- Populate the DNS cache with the hosts (and aliasses) from the hosts file.
local ttl = 10*365*24*60*60 -- use ttl of 10 years for hostfile entries
for name, address in pairs(hosts) do
Expand Down

0 comments on commit 299d01c

Please sign in to comment.