diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-12-16 18:04:11 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-12-16 18:04:11 +0000 |
commit | 8b88ecb62b2ca6717307f78981d43bf21673baed (patch) | |
tree | 70bff3b2aa3f0f3cb6ed934d702ba905f13805a6 /src/libmime/mime_parser.c | |
parent | 7ba8cf9d19aee3b7bf83d151859d0bbab3e81af6 (diff) | |
download | rspamd-8b88ecb62b2ca6717307f78981d43bf21673baed.tar.gz rspamd-8b88ecb62b2ca6717307f78981d43bf21673baed.zip |
[Minor] Parse content disposition header
Diffstat (limited to 'src/libmime/mime_parser.c')
-rw-r--r-- | src/libmime/mime_parser.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/libmime/mime_parser.c b/src/libmime/mime_parser.c index 0b192b8d5..99ee485a3 100644 --- a/src/libmime/mime_parser.c +++ b/src/libmime/mime_parser.c @@ -233,6 +233,44 @@ rspamd_mime_part_get_cte (struct rspamd_task *task, struct rspamd_mime_part *par } } } +static void +rspamd_mime_part_get_cd (struct rspamd_task *task, struct rspamd_mime_part *part) +{ + struct rspamd_mime_header *hdr; + guint i; + GPtrArray *hdrs; + struct rspamd_content_disposition *cd = NULL; + + hdrs = rspamd_message_get_header_from_hash (part->raw_headers, + task->task_pool, + "Content-Disposition", FALSE); + + + if (hdrs == NULL) { + cd = rspamd_mempool_alloc0 (task->task_pool, sizeof (*cd)); + cd->type = RSPAMD_CT_INLINE; + } + else { + for (i = 0; i < hdrs->len; i ++) { + gsize hlen; + + hdr = g_ptr_array_index (hdrs, i); + hlen = strlen (hdr->value); + rspamd_str_lc (hdr->value, hlen); + cd = rspamd_content_disposition_parse (hdr->value, hlen, + task->task_pool); + + if (cd) { + break; + } + } + + msg_debug_mime ("processed content disposition: %s", + cd->lc_data); + } + + part->cd = cd; +} static void rspamd_mime_parser_calc_digest (struct rspamd_mime_part *part) @@ -268,6 +306,7 @@ rspamd_mime_parse_normal_part (struct rspamd_task *task, g_assert (part != NULL); rspamd_mime_part_get_cte (task, part); + rspamd_mime_part_get_cd (task, part); switch (part->cte) { case RSPAMD_CTE_7BIT: |