aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2021-11-29 16:34:30 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2021-11-29 16:34:30 +0000
commit56aab3892dae37af3f5a677bc43ccd27f12a4d4f (patch)
tree397a52731c9f767807e5db7035d480af7f890f22
parentd5131fcf2f9ceedbfdc8a5e28f663c15a1d8ffa7 (diff)
downloadrspamd-56aab3892dae37af3f5a677bc43ccd27f12a4d4f.tar.gz
rspamd-56aab3892dae37af3f5a677bc43ccd27f12a4d4f.zip
[Fix] Fix stuctured headers pushing
-rw-r--r--src/lua/lua_mimepart.c16
-rw-r--r--src/lua/lua_task.c16
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 {