commit 56aab38: [Fix] Fix stuctured headers pushing

Vsevolod Stakhov vsevolod at highsecure.ru
Mon Nov 29 16:35:04 UTC 2021


Author: Vsevolod Stakhov
Date: 2021-11-29 16:34:30 +0000
URL: https://github.com/rspamd/rspamd/commit/56aab3892dae37af3f5a677bc43ccd27f12a4d4f (HEAD -> master)

[Fix] Fix stuctured headers pushing

---
 src/lua/lua_mimepart.c | 16 +++++++++++++---
 src/lua/lua_task.c     | 16 +++++++++++++---
 2 files changed, 26 insertions(+), 6 deletions(-)

diff --git a/src/lua/lua_mimepart.c b/src/lua/lua_mimepart.c
index c03ef35fd..db12cf672 100644
--- a/src/lua/lua_mimepart.c
+++ b/src/lua/lua_mimepart.c
@@ -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 {
diff --git a/src/lua/lua_task.c b/src/lua/lua_task.c
index d3e08dee4..5ca9b4417 100644
--- a/src/lua/lua_task.c
+++ b/src/lua/lua_task.c
@@ -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 {


More information about the Commits mailing list