diff options
author | IKEDA Soji <ikeda@conversion.co.jp> | 2022-08-28 17:02:41 +0900 |
---|---|---|
committer | IKEDA Soji <ikeda@conversion.co.jp> | 2022-09-03 13:01:12 +0900 |
commit | 17b7eded27d23eb963ca49d0487f55142cce72f5 (patch) | |
tree | a45a869ed6692d64dee61ea3ec37bc41ce12179a /src/plugins/lua/milter_headers.lua | |
parent | 66a6a02d0147dc7a5761bb812097561ae2dbf8c0 (diff) | |
download | rspamd-17b7eded27d23eb963ca49d0487f55142cce72f5.tar.gz rspamd-17b7eded27d23eb963ca49d0487f55142cce72f5.zip |
[Fix] milter_headers: Header fields may be inserted at wrong position.
Diffstat (limited to 'src/plugins/lua/milter_headers.lua')
-rw-r--r-- | src/plugins/lua/milter_headers.lua | 47 |
1 files changed, 6 insertions, 41 deletions
diff --git a/src/plugins/lua/milter_headers.lua b/src/plugins/lua/milter_headers.lua index 750b9c453..d83115fc5 100644 --- a/src/plugins/lua/milter_headers.lua +++ b/src/plugins/lua/milter_headers.lua @@ -195,48 +195,13 @@ local function milter_headers(task) local function add_header(name, value, stop_chars, order) local hname = settings.routines[name].header - if order then - if not add[hname] then - add[hname] = { - order = order, - value = lua_util.fold_header(task, hname, value, stop_chars) - } - else - if not add[hname][1] then - -- Convert to a table - add[hname] = { - [1] = add[hname] - } - end - - table.insert(add[hname], { - order = order, - value = lua_util.fold_header(task, hname, value, stop_chars) - }) - end - else - if not add[hname] then - add[hname] = lua_util.fold_header(task, hname, value, stop_chars) - else - if not add[hname][1] then - -- Convert to a table - add[hname] = { - [1] = add[hname] - } - end - - if settings.default_headers_order then - table.insert(add[hname], { - order = settings.default_headers_order, - value = lua_util.fold_header(task, hname, value, stop_chars) - }) - else - table.insert(add[hname], - lua_util.fold_header(task, hname, value, stop_chars)) - end - - end + if not add[hname] then + add[hname] = {} end + table.insert(add[hname], { + order = (order or settings.default_headers_order or -1), + value = lua_util.fold_header(task, hname, value, stop_chars) + }) end routines['x-spamd-result'] = function() |