aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/lua/milter_headers.lua
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/lua/milter_headers.lua')
-rw-r--r--src/plugins/lua/milter_headers.lua11
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)