[dovecot-cvs] dovecot/src/lib-mail message-parser.c,1.43,1.44
message-parser.h,1.20,1.21
cras at procontrol.fi
cras at procontrol.fi
Sun Jul 13 05:08:12 EEST 2003
Update of /home/cvs/dovecot/src/lib-mail
In directory danu:/tmp/cvs-serv17838/lib-mail
Modified Files:
message-parser.c message-parser.h
Log Message:
Ignore Content-* headers if there's no MIME-Version header. Note that this
change breaks cached message parts in indexes.
Index: message-parser.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-mail/message-parser.c,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -d -r1.43 -r1.44
--- message-parser.c 4 Jun 2003 23:00:44 -0000 1.43
+++ message-parser.c 13 Jul 2003 01:08:10 -0000 1.44
@@ -166,6 +166,8 @@
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);
@@ -216,6 +218,11 @@
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;
@@ -228,6 +235,14 @@
parse_content_type_param,
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,
Index: message-parser.h
===================================================================
RCS file: /home/cvs/dovecot/src/lib-mail/message-parser.h,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- message-parser.h 4 Jun 2003 15:57:58 -0000 1.20
+++ message-parser.h 13 Jul 2003 01:08:10 -0000 1.21
@@ -18,7 +18,10 @@
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 {
More information about the dovecot-cvs
mailing list