net.resolvers.basic: Default conn_type to 'tcp' consistently if unspecified (thanks marc0s) 0.11
authorMatthew Wild <mwild1@gmail.com>
Fri, 10 Jul 2020 13:00:02 +0100
branch0.11
changeset 11011 1d8e1f7a587c
parent 10998 e2ce067bb59a
child 11012 fd735fe2fc50
child 11019 355eae2f9ba8
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.
net/resolvers/basic.lua
--- a/net/resolvers/basic.lua	Tue Jul 07 13:52:25 2020 +0100
+++ b/net/resolvers/basic.lua	Fri Jul 10 13:00:02 2020 +0100
@@ -58,6 +58,7 @@
 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 @@
 	return setmetatable({
 		hostname = ascii_host;
 		port = port;
-		conn_type = conn_type or "tcp";
+		conn_type = conn_type;
 		extra = extra;
 		targets = targets;
 	}, resolver_mt);