summaryrefslogtreecommitdiff
path: root/mailbox
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2007-03-06 13:04:03 +0000
committerSergey Poznyakoff <gray@gnu.org.ua>2007-03-06 13:04:03 +0000
commite2e6fa5e54eb3a365aa968ec4e3c83ff55d9be85 (patch)
treede6f71b2730ae0ed3b665ab0d20e1bce4f0b498a /mailbox
parent6ace2b210c301d80c4fc4eada111ad92fd2d1f3e (diff)
downloadmailutils-e2e6fa5e54eb3a365aa968ec4e3c83ff55d9be85.tar.gz
mailutils-e2e6fa5e54eb3a365aa968ec4e3c83ff55d9be85.tar.bz2
(_mime_parse_mpart_message): The CRLF preceding the encapsulation line is conceptually attached to the boundary.
Diffstat (limited to 'mailbox')
-rw-r--r--mailbox/mime.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/mailbox/mime.c b/mailbox/mime.c
index 72440215d..4f237e69a 100644
--- a/mailbox/mime.c
+++ b/mailbox/mime.c
@@ -325,8 +325,6 @@ _mime_parse_mpart_message (mu_mime_t mime)
cp2 =
mime->cur_line[0] ==
'\n' ? mime->cur_line + 1 : mime->cur_line;
- if (mime->header_length)
- mb_lines++;
if (mime->line_ndx >= blength)
{
if ((!strncasecmp (cp2, "--", 2)
@@ -338,10 +336,19 @@ _mime_parse_mpart_message (mu_mime_t mime)
mime->flags &= ~MIME_PARSER_HAVE_CR;
mb_length = mime->cur_offset -
mb_offset - mime->line_ndx;
- if (mb_lines > 1)
- mb_length++;
if (mime->header_length)
/* this skips the preamble */
+ /* RFC 1521 [Page 30]:
+ NOTE: The CRLF preceding the encapsulation line
+ is conceptually attached to the boundary so
+ that it is possible to have a part that does
+ not end with a CRLF (line break). Body parts
+ that must be considered to end with line
+ breaks, therefore, must have two CRLFs
+ preceding the encapsulation line, the first
+ of which is part of the preceding body part,
+ and the second of which is part of the
+ encapsulation boundary. */
_mime_append_part (mime, NULL,
mb_offset, mb_length,
mb_lines - 1);
@@ -360,6 +367,9 @@ _mime_parse_mpart_message (mu_mime_t mime)
break;
}
}
+ else if (mime->header_length)
+ mb_lines++;
+
mime->line_ndx = 0;
mime->cur_line[0] = *cp; /* stay in this state but
leave '\n' at begining */

Return to:

Send suggestions and report system problems to the System administrator.