Comparison

net/resolvers/basic.lua @ 10384:94c9c574cd8a 0.11

net.resolvers: Apply IDNA conversion to ascii for DNS lookups (fixes #1426)
author Kim Alvefur <zash@zash.se>
date Sat, 02 Nov 2019 19:24:26 +0100
parent 9496:4ac3103787cc
child 10385:62a7042e0771
comparison
equal deleted inserted replaced
10348:3852fc91b2fc 10384:94c9c574cd8a
1 local adns = require "net.adns"; 1 local adns = require "net.adns";
2 local inet_pton = require "util.net".pton; 2 local inet_pton = require "util.net".pton;
3 local idna_to_ascii = require "util.encodings".idna.to_ascii;
3 4
4 local methods = {}; 5 local methods = {};
5 local resolver_mt = { __index = methods }; 6 local resolver_mt = { __index = methods };
6 7
7 -- Find the next target to connect to, and 8 -- Find the next target to connect to, and
57 end, self.hostname, "AAAA", "IN"); 58 end, self.hostname, "AAAA", "IN");
58 end 59 end
59 60
60 local function new(hostname, port, conn_type, extra) 61 local function new(hostname, port, conn_type, extra)
61 return setmetatable({ 62 return setmetatable({
62 hostname = hostname; 63 hostname = idna_to_ascii(hostname);
63 port = port; 64 port = port;
64 conn_type = conn_type or "tcp"; 65 conn_type = conn_type or "tcp";
65 extra = extra; 66 extra = extra;
66 }, resolver_mt); 67 }, resolver_mt);
67 end 68 end