Changeset

11007:1d8e1f7a587c 0.11

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.
author Matthew Wild <mwild1@gmail.com>
date Fri, 10 Jul 2020 13:00:02 +0100
parents 10994:e2ce067bb59a
children 11008:fd735fe2fc50 11015:355eae2f9ba8
files net/resolvers/basic.lua
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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);