commit 9a6e45f: [Minor] Milter_headers: Support default headers order

Vsevolod Stakhov vsevolod at highsecure.ru
Thu Feb 11 17:35:07 UTC 2021


Author: Vsevolod Stakhov
Date: 2021-02-11 17:33:24 +0000
URL: https://github.com/rspamd/rspamd/commit/9a6e45f6ee260958cc19c9a4c8860ae82d77a381 (HEAD -> master)

[Minor] Milter_headers: Support default headers order
Issue: #3644

---
 src/plugins/lua/milter_headers.lua | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/src/plugins/lua/milter_headers.lua b/src/plugins/lua/milter_headers.lua
index 305cc6411..35b682a8f 100644
--- a/src/plugins/lua/milter_headers.lua
+++ b/src/plugins/lua/milter_headers.lua
@@ -38,6 +38,7 @@ local settings = {
   skip_all = false,
   local_headers = {},
   authenticated_headers = {},
+  default_headers_order = nil, -- Insert at the end (set 1 to insert just after the first received)
   routines = {
     ['remove-headers'] = {
       headers = {},
@@ -219,8 +220,16 @@ local function milter_headers(task)
           }
         end
 
-        table.insert(add[hname],
-            lua_util.fold_header(task, hname, value, stop_chars))
+        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
     end
   end


More information about the Commits mailing list