diff options
author | Vsevolod Stakhov <vsevolod@rspamd.com> | 2024-07-17 12:26:26 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rspamd.com> | 2024-07-17 12:26:26 +0100 |
commit | ec5de28f160e312ea2795cb4a82368a1fbb0c9ea (patch) | |
tree | c00d2ccea61b4cbc4d27f3e2223d94fdbfc18fac /src | |
parent | 6045b2873a1c212aa51b0250b1f5193a28d853f5 (diff) | |
download | rspamd-ec5de28f160e312ea2795cb4a82368a1fbb0c9ea.tar.gz rspamd-ec5de28f160e312ea2795cb4a82368a1fbb0c9ea.zip |
[Fix] Encode headers that we send to milter add header
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/lua/milter_headers.lua | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/plugins/lua/milter_headers.lua b/src/plugins/lua/milter_headers.lua index b53a45457..58a227fec 100644 --- a/src/plugins/lua/milter_headers.lua +++ b/src/plugins/lua/milter_headers.lua @@ -22,7 +22,7 @@ end -- A plugin that provides common header manipulations local logger = require "rspamd_logger" -local util = require "rspamd_util" +local rspamd_util = require "rspamd_util" local N = 'milter_headers' local lua_util = require "lua_util" local lua_maps = require "lua_maps" @@ -30,7 +30,7 @@ local lua_mime = require "lua_mime" local ts = require("tableshape").types local E = {} -local HOSTNAME = util.get_hostname() +local HOSTNAME = rspamd_util.get_hostname() local settings = { remove_upstream_spam_flag = true; @@ -213,6 +213,13 @@ local function milter_headers(task) if not add[hname] then add[hname] = {} end + if rspamd_config:is_mime_utf8() then + if not rspamd_util.is_valid_utf8(value) then + value = rspamd_util.mime_header_encode(value) + end + else + value = rspamd_util.mime_header_encode(value) + end table.insert(add[hname], { order = (order or settings.default_headers_order or -1), value = lua_util.fold_header(task, hname, value, stop_chars) |