# HG changeset patch # User Kim Alvefur # Date 1574566867 -3600 # Node ID 97c0f5fe5f41ad07ce507f7398f2830d8d36300e # Parent fcfc8f4d14a83307a1a2a13f66515f0a4b45b49d net.resolvers.basic: Normalise IP literals, ensures net.server is happy diff -r fcfc8f4d14a8 -r 97c0f5fe5f41 net/resolvers/basic.lua --- a/net/resolvers/basic.lua Sun Nov 24 04:26:44 2019 +0100 +++ b/net/resolvers/basic.lua Sun Nov 24 04:41:07 2019 +0100 @@ -1,5 +1,6 @@ local adns = require "net.adns"; local inet_pton = require "util.net".pton; +local inet_ntop = require "util.net".ntop; local idna_to_ascii = require "util.encodings".idna.to_ascii; local methods = {}; @@ -63,6 +64,7 @@ is_ip = inet_pton(hostname:sub(2,-2)); end if is_ip then + hostname = inet_ntop(is_ip); if #is_ip == 16 then targets = { { conn_type.."6", hostname, port, extra } }; elseif #is_ip == 4 then