From: Vsevolod Stakhov Date: Wed, 21 Aug 2019 15:05:41 +0000 (+0100) Subject: [Minor] Improve redirected urls processing in filter_specific_urls X-Git-Tag: 2.0~364 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=4745be02184e81354ae548b47c099b4a8d62e19e;p=rspamd.git [Minor] Improve redirected urls processing in filter_specific_urls --- diff --git a/lualib/lua_util.lua b/lualib/lua_util.lua index 4dddb979f..4aa39db9b 100644 --- a/lualib/lua_util.lua +++ b/lualib/lua_util.lua @@ -681,27 +681,30 @@ exports.filter_specific_urls = function (urls, params) return false end - local function process_single_url(u) - local priority = 1 -- Normal priority - local esld = u:get_tld() + local function process_single_url(u, default_priority) + local priority = default_priority or 1 -- Normal priority - if params.ignore_redirected and u:is_redirected() then + if u:is_redirected() then local redir = u:get_redirected() -- get the real url - local redir_tld = redir:get_tld() - if redir_tld then - -- Ignore redirected as it should also be in the hash - return + if params.ignore_redirected then + -- Replace `u` with redir + u = redir + priority = 2 + else + -- Process both redirected url and the original one + process_single_url(redir, 2) end end + local esld = u:get_tld() local str_hash = tostring(u) if esld then -- Special cases if (u:get_protocol() ~= 'mailto') and (not u:is_html_displayed()) then if u:is_obscured() then - priority = 2 + priority = 3 else if u:get_user() then priority = 2