# HG changeset patch # User Kim Alvefur # Date 1572719892 -3600 # Node ID cf93a951da37fbba24913fcf1341e1a646343192 # Parent 496248e48a1dd9f8cd68a90c06d4d1ab577b812d# Parent 62a7042e0771e165b24d94169295af47cacd9d7e Merge 0.11->trunk diff -r 496248e48a1d -r cf93a951da37 net/resolvers/basic.lua --- a/net/resolvers/basic.lua Sat Nov 02 16:02:37 2019 +0100 +++ b/net/resolvers/basic.lua Sat Nov 02 19:38:12 2019 +0100 @@ -1,5 +1,6 @@ local adns = require "net.adns"; local inet_pton = require "util.net".pton; +local idna_to_ascii = require "util.encodings".idna.to_ascii; local unpack = table.unpack or unpack; -- luacheck: ignore 113 local methods = {}; @@ -18,6 +19,11 @@ return; end + if not self.hostname then + -- FIXME report IDNA error + cb(nil); + end + local targets = {}; local n = 2; local function ready() @@ -60,7 +66,7 @@ local function new(hostname, port, conn_type, extra) return setmetatable({ - hostname = hostname; + hostname = idna_to_ascii(hostname); port = port; conn_type = conn_type or "tcp"; extra = extra; diff -r 496248e48a1d -r cf93a951da37 net/resolvers/service.lua --- 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;