dovecot: By default assume MIME message if Content-Type: exists ...

dovecot at dovecot.org dovecot at dovecot.org
Thu Aug 2 14:21:11 EEST 2007


details:   http://hg.dovecot.org/dovecot/rev/e18086698ebf
changeset: 6156:e18086698ebf
user:      Timo Sirainen <tss at iki.fi>
date:      Thu Aug 02 14:21:05 2007 +0300
description:
By default assume MIME message if Content-Type: exists even if Mime-Version:
doesn't. MESSAGE_PARSER_FLAG_MIME_VERSION_STRICT disables this.

diffstat:

2 files changed, 10 insertions(+), 1 deletion(-)
src/lib-mail/message-parser.c |    4 ++++
src/lib-mail/message-parser.h |    7 ++++++-

diffs (31 lines):

diff -r f0d8c9056706 -r e18086698ebf src/lib-mail/message-parser.c
--- a/src/lib-mail/message-parser.c	Wed Aug 01 14:38:28 2007 +0300
+++ b/src/lib-mail/message-parser.c	Thu Aug 02 14:21:05 2007 +0300
@@ -457,6 +457,10 @@ static int parse_next_header(struct mess
 			/* it's MIME. Content-* headers are valid */
 			part->flags |= MESSAGE_PART_FLAG_IS_MIME;
 		} else if (strcasecmp(hdr->name, "Content-Type") == 0) {
+			if ((ctx->flags &
+			     MESSAGE_PARSER_FLAG_MIME_VERSION_STRICT) == 0)
+				part->flags |= MESSAGE_PART_FLAG_IS_MIME;
+
 			if (hdr->continues)
 				hdr->use_full_value = TRUE;
 			else {
diff -r f0d8c9056706 -r e18086698ebf src/lib-mail/message-parser.h
--- a/src/lib-mail/message-parser.h	Wed Aug 01 14:38:28 2007 +0300
+++ b/src/lib-mail/message-parser.h	Thu Aug 02 14:21:05 2007 +0300
@@ -5,7 +5,12 @@
 #include "message-size.h"
 
 enum message_parser_flags {
-	MESSAGE_PARSER_FLAG_SKIP_BODY_BLOCK	= 0x01
+	/* Don't return message bodies in message_blocks. */
+	MESSAGE_PARSER_FLAG_SKIP_BODY_BLOCK	= 0x01,
+	/* Buggy software creates Content-Type: headers without Mime-Version:
+	   header. By default we allow this and assume message is MIME if
+	   Content-Type: is found. This flag disables this. */
+	MESSAGE_PARSER_FLAG_MIME_VERSION_STRICT	= 0x02
 };
 
 /* Note that these flags are used directly by message-parser-serialize, so


More information about the dovecot-cvs mailing list