diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-03-28 17:56:23 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-03-28 18:14:10 +0100 |
commit | fc73009371f8aa71bee1ba591597c774687046e4 (patch) | |
tree | ff00a0b12c46dfa93067b46d682e6ece8c254798 /lualib | |
parent | 65aad44f07d8b799d84fd6241ff4fb4e1e1bc20a (diff) | |
download | rspamd-fc73009371f8aa71bee1ba591597c774687046e4.tar.gz rspamd-fc73009371f8aa71bee1ba591597c774687046e4.zip |
[Minor] Add routine to simplify headers folding
Diffstat (limited to 'lualib')
-rw-r--r-- | lualib/lua_util.lua | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/lualib/lua_util.lua b/lualib/lua_util.lua index 33d7e3714..d97f58175 100644 --- a/lualib/lua_util.lua +++ b/lualib/lua_util.lua @@ -21,6 +21,7 @@ limitations under the License. local exports = {} local lpeg = require 'lpeg' +local rspamd_util = require "rspamd_util" local split_grammar = {} @@ -420,4 +421,21 @@ end exports.table_cmp = table_cmp +--[[[ +-- @function lua_util.table_cmp(task, name, value, stop_chars) +-- Performs header folding +--]] +exports.fold_header = function(task, name, value, stop_chars) + + local how + + if task:has_flag("milter") then + how = "lf" + else + how = task:get_newlines_type() + end + + return rspamd_util.fold_header(name, value, how, stop_chars) +end + return exports |