Changeset

10437:fcfc8f4d14a8 0.11

net.resolvers.basic: Fix resolution of IPv6 literals (in brackets) (fixes #1459)
author Kim Alvefur <zash@zash.se>
date Sun, 24 Nov 2019 04:26:44 +0100
parents 10436:0d702ec77f0c
children 10438:55490be0dc29 10439:97c0f5fe5f41
files net/resolvers/basic.lua
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/net/resolvers/basic.lua	Sun Nov 24 04:23:51 2019 +0100
+++ b/net/resolvers/basic.lua	Sun Nov 24 04:26:44 2019 +0100
@@ -59,6 +59,9 @@
 	local targets = nil;
 
 	local is_ip = inet_pton(hostname);
+	if not is_ip and hostname:sub(1,1) == '[' then
+		is_ip = inet_pton(hostname:sub(2,-2));
+	end
 	if is_ip then
 		if #is_ip == 16 then
 			targets = { { conn_type.."6", hostname, port, extra } };