Fix hostname validation in URI

This commit is contained in:
Alfredo Cardigliano 2021-07-07 12:22:44 +02:00
parent 423b596f52
commit 4ca5eb238e
2 changed files with 7 additions and 1 deletions

View file

@ -26,6 +26,12 @@ if isEmptyString(hostname) then
return
end
if string.find(hostname, '://') then
-- Looks like an URI, strip the scheme
local uri_info = string.split(hostname, "://")
hostname = uri_info[2]
end
local resolved = ntop.resolveHost(hostname, true --[[ IPv4 --]])
if not resolved then
resolved = ntop.resolveHost(hostname, false --[[ IPv6 --]])