diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-05-14 10:44:53 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-05-14 10:45:38 +0100 |
commit | acb55a11b92782c0e95cbfa946acbdafc8beeea8 (patch) | |
tree | 1d53d3a55f5bf9e73bace3179f448e4f039a75b9 /src | |
parent | dd3228b070a1091e2d303e8980092f755c242674 (diff) | |
download | rspamd-acb55a11b92782c0e95cbfa946acbdafc8beeea8.tar.gz rspamd-acb55a11b92782c0e95cbfa946acbdafc8beeea8.zip |
[Minor] Rework and fix headers addition
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/lua/milter_headers.lua | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/src/plugins/lua/milter_headers.lua b/src/plugins/lua/milter_headers.lua index 73b268b2e..fb2d20db8 100644 --- a/src/plugins/lua/milter_headers.lua +++ b/src/plugins/lua/milter_headers.lua @@ -182,39 +182,39 @@ local function milter_headers(task) local routines, common, add, remove = {}, {}, {}, {} local function add_header(name, value, stop_chars, order) + local hname = settings.routines[name].header if order then - if not add[settings.routines[name].header] then - add[settings.routines[name].header] = { + if not add[hname] then + add[hname] = { order = order, - value = lua_util.fold_header(task, name, value, stop_chars) + value = lua_util.fold_header(task, hname, value, stop_chars) } else - if not add[settings.routines[name].header][1] then + if not add[hname][1] then -- Convert to a table - add[settings.routines[name].header] = { - [1] = add[settings.routines[name].header] + add[hname] = { + [1] = add[hname] } end - table.insert(add[settings.routines[name].header], { + table.insert(add[hname], { order = order, - value = lua_util.fold_header(task, name, value, stop_chars) + value = lua_util.fold_header(task, hname, value, stop_chars) }) end else - if not add[settings.routines[name].header] then - add[settings.routines[name].header] = lua_util.fold_header(task, name, - value, stop_chars) + if not add[hname] then + add[hname] = lua_util.fold_header(task, hname, value, stop_chars) else - if not add[settings.routines[name].header][1] then + if not add[hname][1] then -- Convert to a table - add[settings.routines[name].header] = { - [1] = add[settings.routines[name].header] + add[hname] = { + [1] = add[hname] } end - table.insert(add[settings.routines[name].header], - lua_util.fold_header(task, name, value, stop_chars)) + table.insert(add[hname], + lua_util.fold_header(task, hname, value, stop_chars)) end end end @@ -470,7 +470,7 @@ local function milter_headers(task) if res and #res > 0 then for _,h in ipairs(res) do - add_header(add[settings.routines['fuzzy-hashes'].header], h) + add_header('fuzzy-hashes', h) end end end |