]> source.dussan.org Git - rspamd.git/commitdiff
[Fix] Fix stuctured headers pushing
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 29 Nov 2021 16:34:30 +0000 (16:34 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 29 Nov 2021 16:34:30 +0000 (16:34 +0000)
src/lua/lua_mimepart.c
src/lua/lua_task.c

index c03ef35fd2451458cd13ed9c85d7afc1123dcfea..db12cf6729a51761d4c4961041252effe60fce98 100644 (file)
@@ -1761,9 +1761,19 @@ lua_mimepart_get_headers (lua_State *L)
 
                lua_createtable (L, rspamd_mime_headers_count(part->raw_headers), 0);
                LL_FOREACH2(part->headers_order, cur, ord_next) {
-                       rspamd_lua_push_header_array(L, cur->name, cur, RSPAMD_TASK_HEADER_PUSH_FULL,
-                                       need_modified);
-                       lua_rawseti(L, -2, i++);
+                       if (need_modified && cur->modified_chain) {
+                               struct rspamd_mime_header *cur_modified;
+
+                               LL_FOREACH(cur->modified_chain, cur_modified) {
+                                       rspamd_lua_push_header(L, cur_modified, RSPAMD_TASK_HEADER_PUSH_FULL);
+                                       lua_rawseti(L, -2, i++);
+                               }
+                       }
+                       else {
+                               rspamd_lua_push_header(L, cur, RSPAMD_TASK_HEADER_PUSH_FULL);
+                               lua_rawseti(L, -2, i++);
+                       }
+
                }
        }
        else {
index d3e08dee409955e0739992109b75eb3732af65b3..5ca9b44175fa911720621063a1f37b5891a3a9c3 100644 (file)
@@ -3135,9 +3135,19 @@ lua_task_get_headers (lua_State *L)
 
                lua_createtable (L, rspamd_mime_headers_count(MESSAGE_FIELD(task, raw_headers)), 0);
                LL_FOREACH2(MESSAGE_FIELD(task, headers_order), cur, ord_next) {
-                       rspamd_lua_push_header_array(L, cur->name, cur, RSPAMD_TASK_HEADER_PUSH_FULL,
-                                       need_modified);
-                       lua_rawseti(L, -2, i++);
+                       if (need_modified && cur->modified_chain) {
+                               struct rspamd_mime_header *cur_modified;
+
+                               LL_FOREACH(cur->modified_chain, cur_modified) {
+                                       rspamd_lua_push_header(L, cur_modified, RSPAMD_TASK_HEADER_PUSH_FULL);
+                                       lua_rawseti(L, -2, i++);
+                               }
+                       }
+                       else {
+                               rspamd_lua_push_header(L, cur, RSPAMD_TASK_HEADER_PUSH_FULL);
+                               lua_rawseti(L, -2, i++);
+                       }
+
                }
        }
        else {