commit b18a524: [Feature] Milter_headers: Add x-rspamd-pre-result header
Vsevolod Stakhov
vsevolod at highsecure.ru
Tue Jun 15 16:28:05 UTC 2021
Author: Vsevolod Stakhov
Date: 2021-06-15 17:25:59 +0100
URL: https://github.com/rspamd/rspamd/commit/b18a524f6839b83d0feab26264d74fb21a496dd3
[Feature] Milter_headers: Add x-rspamd-pre-result header
---
src/plugins/lua/milter_headers.lua | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/src/plugins/lua/milter_headers.lua b/src/plugins/lua/milter_headers.lua
index d8240c16c..0dfaa9e03 100644
--- a/src/plugins/lua/milter_headers.lua
+++ b/src/plugins/lua/milter_headers.lua
@@ -66,6 +66,10 @@ local settings = {
header = 'X-Rspamd-Queue-Id',
remove = 0,
},
+ ['x-rspamd-pre-result'] = {
+ header = 'X-Rspamd-Pre-Result',
+ remove = 0,
+ },
['remove-spam-flag'] = {
header = 'X-Spam',
},
@@ -277,6 +281,22 @@ local function milter_headers(task)
table.insert(buf, sym_str)
end
add_header('x-spamd-result', table.concat(buf, '; '), ';')
+
+ local has_pr,action,message,module = task:has_pre_result()
+
+ if has_pr then
+ local pr_header = {}
+ if action then
+ table.insert(pr_header, string.format('action=%s', action))
+ end
+ if module then
+ table.insert(pr_header, string.format('module=%s', module))
+ end
+ if message then
+ table.insert(pr_header, message)
+ end
+ add_header('x-rspamd-pre-result', table.concat(pr_header, '; '), ';')
+ end
end
routines['x-rspamd-queue-id'] = function()
More information about the Commits
mailing list