Diff

net/resolvers/service.lua @ 10386:cf93a951da37

Merge 0.11->trunk
author Kim Alvefur <zash@zash.se>
date Sat, 02 Nov 2019 19:38:12 +0100
parent 10121:33f287519bf6
parent 10385:62a7042e0771
child 10401:1ef1f6c43c5b
line wrap: on
line diff
--- a/net/resolvers/service.lua	Sat Nov 02 16:02:37 2019 +0100
+++ b/net/resolvers/service.lua	Sat Nov 02 19:38:12 2019 +0100
@@ -1,5 +1,6 @@
 local adns = require "net.adns";
 local basic = require "net.resolvers.basic";
+local idna_to_ascii = require "util.encodings".idna.to_ascii;
 local unpack = table.unpack or unpack; -- luacheck: ignore 113
 
 local methods = {};
@@ -25,6 +26,11 @@
 		return;
 	end
 
+	if not self.hostname then
+		-- FIXME report IDNA error
+		cb(nil);
+	end
+
 	local targets = {};
 	local function ready()
 		self.targets = targets;
@@ -63,7 +69,7 @@
 
 local function new(hostname, service, conn_type, extra)
 	return setmetatable({
-		hostname = hostname;
+		hostname = idna_to_ascii(hostname);
 		service = service;
 		conn_type = conn_type or "tcp";
 		extra = extra;