aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2019-11-24 04:41:07 +0100
committerKim Alvefur <zash@zash.se>2019-11-24 04:41:07 +0100
commitd9c64e1f412ce232e44eac499f006292d8cc720b (patch)
treec84f5bfc1cbbff0ca4a9b83cceb00b80d9d5bb77 /net
parenta5450086e824443cff04adc9ed5ec3cca8301151 (diff)
downloadprosody-d9c64e1f412ce232e44eac499f006292d8cc720b.tar.gz
prosody-d9c64e1f412ce232e44eac499f006292d8cc720b.zip
net.resolvers.basic: Normalise IP literals, ensures net.server is happy
Diffstat (limited to 'net')
-rw-r--r--net/resolvers/basic.lua2
1 files changed, 2 insertions, 0 deletions
diff --git a/net/resolvers/basic.lua b/net/resolvers/basic.lua
index 93182fda..08c71ef5 100644
--- a/net/resolvers/basic.lua
+++ b/net/resolvers/basic.lua
@@ -1,5 +1,6 @@
local adns = require "net.adns";
local inet_pton = require "util.net".pton;
+local inet_ntop = require "util.net".ntop;
local idna_to_ascii = require "util.encodings".idna.to_ascii;
local methods = {};
@@ -63,6 +64,7 @@ local function new(hostname, port, conn_type, extra)
is_ip = inet_pton(hostname:sub(2,-2));
end
if is_ip then
+ hostname = inet_ntop(is_ip);
if #is_ip == 16 then
targets = { { conn_type.."6", hostname, port, extra } };
elseif #is_ip == 4 then