Software /
code /
prosody
Changeset
10386:cf93a951da37
Merge 0.11->trunk
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 02 Nov 2019 19:38:12 +0100 |
parents | 10383:496248e48a1d (current diff) 10385:62a7042e0771 (diff) |
children | 10387:f57a4ac87f96 |
files | net/resolvers/basic.lua net/resolvers/service.lua |
diffstat | 2 files changed, 14 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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;
--- 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;