aboutsummaryrefslogtreecommitdiffstats
path: root/net/resolvers
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2020-07-10 13:00:02 +0100
committerMatthew Wild <mwild1@gmail.com>2020-07-10 13:00:02 +0100
commita80cdecc466865986cd7928b6b4d070905e1fd73 (patch)
tree079555aeea51534a9eb04b668f4bfcbaa2215194 /net/resolvers
parentbfd9789cb197c9d5e2fcba6023976c409172401e (diff)
downloadprosody-a80cdecc466865986cd7928b6b4d070905e1fd73.tar.gz
prosody-a80cdecc466865986cd7928b6b4d070905e1fd73.zip
net.resolvers.basic: Default conn_type to 'tcp' consistently if unspecified (thanks marc0s)
Fixes a traceback when passed an IP address with no conn_type.
Diffstat (limited to 'net/resolvers')
-rw-r--r--net/resolvers/basic.lua3
1 files changed, 2 insertions, 1 deletions
diff --git a/net/resolvers/basic.lua b/net/resolvers/basic.lua
index 08c71ef5..867ccf60 100644
--- a/net/resolvers/basic.lua
+++ b/net/resolvers/basic.lua
@@ -58,6 +58,7 @@ end
local function new(hostname, port, conn_type, extra)
local ascii_host = idna_to_ascii(hostname);
local targets = nil;
+ conn_type = conn_type or "tcp";
local is_ip = inet_pton(hostname);
if not is_ip and hostname:sub(1,1) == '[' then
@@ -75,7 +76,7 @@ local function new(hostname, port, conn_type, extra)
return setmetatable({
hostname = ascii_host;
port = port;
- conn_type = conn_type or "tcp";
+ conn_type = conn_type;
extra = extra;
targets = targets;
}, resolver_mt);