aboutsummaryrefslogtreecommitdiffstats
path: root/src/libmime/mime_parser.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2020-02-07 12:31:50 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2020-02-07 12:31:50 +0000
commit5f775f8c3d916bf09c5791518b73d2cc548cf89b (patch)
treee87a0d1b3fa98a6a5f356c599cb5369988eb218e /src/libmime/mime_parser.c
parent3ced568c329cfcf49b8cd7dd39692eb6767515c1 (diff)
downloadrspamd-5f775f8c3d916bf09c5791518b73d2cc548cf89b.tar.gz
rspamd-5f775f8c3d916bf09c5791518b73d2cc548cf89b.zip
[Fix] Fix all headers iteration
Diffstat (limited to 'src/libmime/mime_parser.c')
-rw-r--r--src/libmime/mime_parser.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/libmime/mime_parser.c b/src/libmime/mime_parser.c
index d989a8e2e..ce8162401 100644
--- a/src/libmime/mime_parser.c
+++ b/src/libmime/mime_parser.c
@@ -707,6 +707,11 @@ rspamd_mime_process_multipart_node (struct rspamd_task *task,
npart->raw_headers_str,
npart->raw_headers_len,
FALSE);
+
+ /* Preserve the natural order */
+ if (npart->headers_order) {
+ LL_REVERSE2 (npart->headers_order, ord_next);
+ }
}
hdr = rspamd_message_get_header_from_hash (npart->raw_headers,
@@ -1265,6 +1270,11 @@ rspamd_mime_parse_message (struct rspamd_task *task,
TRUE);
npart->raw_headers = rspamd_message_headers_ref (
MESSAGE_FIELD (task, raw_headers));
+
+ /* Preserve the natural order */
+ if (MESSAGE_FIELD (task, headers_order)) {
+ LL_REVERSE2 (MESSAGE_FIELD (task, headers_order), ord_next);
+ }
}
hdr = rspamd_message_get_header_from_hash (
@@ -1290,6 +1300,11 @@ rspamd_mime_parse_message (struct rspamd_task *task,
TRUE);
npart->raw_headers = rspamd_message_headers_ref (
MESSAGE_FIELD (task, raw_headers));
+
+ /* Preserve the natural order */
+ if (MESSAGE_FIELD (task, headers_order)) {
+ LL_REVERSE2 (MESSAGE_FIELD (task, headers_order), ord_next);
+ }
}
hdr = rspamd_message_get_header_from_hash (
@@ -1341,6 +1356,11 @@ rspamd_mime_parse_message (struct rspamd_task *task,
npart->raw_headers_str,
npart->raw_headers_len,
FALSE);
+
+ /* Preserve the natural order */
+ if (npart->headers_order) {
+ LL_REVERSE2 (npart->headers_order, ord_next);
+ }
}
hdr = rspamd_message_get_header_from_hash (npart->raw_headers,