Support also port in uri when validating hosts

This commit is contained in:
Alfredo Cardigliano 2021-07-07 12:52:25 +02:00
parent 806dfb3e19
commit fdd9a8f399

View file

@ -29,7 +29,17 @@ end
if string.find(hostname, '://') then
-- Looks like an URI, strip the scheme
local uri_info = string.split(hostname, "://")
hostname = uri_info[2]
if #uri_info == 2 then
hostname = uri_info[2]
end
end
if string.find(hostname, ':') then
local host_port_info = string.split(hostname, ":")
if #host_port_info == 2 then
-- Looks like host:port, strip the port
hostname = host_port_info[1]
end
end
local resolved = ntop.resolveHost(hostname, true --[[ IPv4 --]])