t_push();
- parse_content_header(part_data, hdr, pool);
+ if ((part->flags & MESSAGE_PART_FLAG_IS_MIME) != 0)
+ parse_content_header(part_data, hdr, pool);
if (parent_rfc822) {
/* message/rfc822, we need the envelope */
while (next_part == parent_part) {
/* new child */
part = message_part_append(parser_ctx->pool, parent_part);
+ if ((parent_part->flags & MESSAGE_PART_FLAG_IS_MIME) != 0)
+ part->flags |= MESSAGE_PART_FLAG_IS_MIME;
parser_ctx->part = part;
next_part = message_parse_part(input, parser_ctx);
parser_ctx->context);
}
+ if (!hdr->eoh && strcasecmp(hdr->name, "Mime-Version") == 0) {
+ /* it's MIME. Content-* headers are valid */
+ parser_ctx->part->flags |= MESSAGE_PART_FLAG_IS_MIME;
+ }
+
if (!hdr->eoh && strcasecmp(hdr->name, "Content-Type") == 0) {
if (hdr->continues) {
hdr->use_full_value = TRUE;
parser_ctx);
}
}
+
+ if ((parser_ctx->part->flags & MESSAGE_PART_FLAG_IS_MIME) == 0) {
+ /* It's not MIME. Reset everything we found from
+ Content-Type. */
+ parser_ctx->part->flags = 0;
+ parser_ctx->last_boundary = NULL;
+ parser_ctx->last_content_type = NULL;
+ }
if (parser_ctx->callback != NULL) {
parser_ctx->callback(parser_ctx->part, NULL,
parser_ctx->context);
MESSAGE_PART_FLAG_BINARY = 0x10,
/* message part header or body contains NULs */
- MESSAGE_PART_FLAG_HAS_NULS = 0x20
+ MESSAGE_PART_FLAG_HAS_NULS = 0x20,
+
+ /* Mime-Version header exists. */
+ MESSAGE_PART_FLAG_IS_MIME = 0x40
};
struct message_part {