diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-10-26 11:56:47 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-26 11:56:47 +0100 |
commit | 91c5c10d2c1c46d2ef1fa42f88f7aaeb3c690abb (patch) | |
tree | efb21cdc5b79fff39e09316a0ecbd62f6404f777 /src/plugins/lua/reputation.lua | |
parent | 76181fd6823a644c2670b36341915ad51e804eb2 (diff) | |
parent | 3731797bf86bda905b6db44ada175fbed96b3d7a (diff) | |
download | rspamd-91c5c10d2c1c46d2ef1fa42f88f7aaeb3c690abb.tar.gz rspamd-91c5c10d2c1c46d2ef1fa42f88f7aaeb3c690abb.zip |
Merge pull request #3121 from philr/fix_url_reputation_filter
[Fix] Reputation: Fix a failure when calcuating URL reputation
Diffstat (limited to 'src/plugins/lua/reputation.lua')
-rw-r--r-- | src/plugins/lua/reputation.lua | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/plugins/lua/reputation.lua b/src/plugins/lua/reputation.lua index 6b43c7fb4..8b2b8c5a4 100644 --- a/src/plugins/lua/reputation.lua +++ b/src/plugins/lua/reputation.lua @@ -284,15 +284,15 @@ local function gen_url_queries(task, rule) end local function url_reputation_filter(task, rule) - local requests = lua_util.extract_specific_urls(task, rule.selector.config.max_urls) + local requests = gen_url_queries(task, rule) local results = {} local nchecked = 0 - local function tokens_cb(err, token, values) + local function indexed_tokens_cb(err, index, values) nchecked = nchecked + 1 if values then - results[token] = values + results[index] = values end if nchecked == #requests then @@ -319,8 +319,12 @@ local function url_reputation_filter(task, rule) end end - for _,u in ipairs(requests) do - rule.backend.get_token(task, rule, u:get_tld(), tokens_cb) + for i,req in ipairs(requests) do + local function tokens_cb(err, token, values) + indexed_tokens_cb(err, i, values) + end + + rule.backend.get_token(task, rule, req[1], tokens_cb) end end |