net.resolvers: Apply IDNA conversion to ascii for DNS lookups (fixes #1426)

This commit is contained in:
Kim Alvefur 2019-11-02 19:24:26 +01:00
parent 9bd711b194
commit ba431b5efc
2 changed files with 4 additions and 2 deletions

View file

@ -1,5 +1,6 @@
local adns = require "net.adns"; local adns = require "net.adns";
local inet_pton = require "util.net".pton; local inet_pton = require "util.net".pton;
local idna_to_ascii = require "util.encodings".idna.to_ascii;
local methods = {}; local methods = {};
local resolver_mt = { __index = methods }; local resolver_mt = { __index = methods };
@ -59,7 +60,7 @@ end
local function new(hostname, port, conn_type, extra) local function new(hostname, port, conn_type, extra)
return setmetatable({ return setmetatable({
hostname = hostname; hostname = idna_to_ascii(hostname);
port = port; port = port;
conn_type = conn_type or "tcp"; conn_type = conn_type or "tcp";
extra = extra; extra = extra;

View file

@ -1,5 +1,6 @@
local adns = require "net.adns"; local adns = require "net.adns";
local basic = require "net.resolvers.basic"; local basic = require "net.resolvers.basic";
local idna_to_ascii = require "util.encodings".idna.to_ascii;
local methods = {}; local methods = {};
local resolver_mt = { __index = methods }; local resolver_mt = { __index = methods };
@ -58,7 +59,7 @@ end
local function new(hostname, service, conn_type, extra) local function new(hostname, service, conn_type, extra)
return setmetatable({ return setmetatable({
hostname = hostname; hostname = idna_to_ascii(hostname);
service = service; service = service;
conn_type = conn_type or "tcp"; conn_type = conn_type or "tcp";
extra = extra; extra = extra;