From: Vsevolod Stakhov Date: Tue, 15 Jun 2021 16:25:59 +0000 (+0100) Subject: [Feature] Milter_headers: Add x-rspamd-pre-result header X-Git-Tag: 3.0~295 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=b18a524f6839b83d0feab26264d74fb21a496dd3;p=rspamd.git [Feature] Milter_headers: Add x-rspamd-pre-result header --- 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()