aboutsummaryrefslogtreecommitdiffstats
path: root/net/resolvers
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2019-11-02 19:38:12 +0100
committerKim Alvefur <zash@zash.se>2019-11-02 19:38:12 +0100
commit690775a9b4cc8b36c5f46211c713d4638cc99c1c (patch)
tree959d4a49be75f90dbcb5555db7054c7cdcc01905 /net/resolvers
parent1a78e0a7ac93b3d0b4251a865eb994bcd3e5eaba (diff)
parent9c2a74d09c9c45d165a4bcf51f4debfac8877e36 (diff)
downloadprosody-690775a9b4cc8b36c5f46211c713d4638cc99c1c.tar.gz
prosody-690775a9b4cc8b36c5f46211c713d4638cc99c1c.zip
Merge 0.11->trunk
Diffstat (limited to 'net/resolvers')
-rw-r--r--net/resolvers/basic.lua8
-rw-r--r--net/resolvers/service.lua8
2 files changed, 14 insertions, 2 deletions
diff --git a/net/resolvers/basic.lua b/net/resolvers/basic.lua
index 56f9c77d..7f25a894 100644
--- a/net/resolvers/basic.lua
+++ b/net/resolvers/basic.lua
@@ -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 @@ function methods:next(cb)
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 @@ end
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 --git a/net/resolvers/service.lua b/net/resolvers/service.lua
index 62d269e5..f9a30f91 100644
--- a/net/resolvers/service.lua
+++ b/net/resolvers/service.lua
@@ -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 @@ function methods:next(cb)
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 @@ end
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;