aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--camel/ChangeLog6
-rw-r--r--camel/camel-mime-parser.c32
2 files changed, 28 insertions, 10 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index 91aef64322..7e38c2d529 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,3 +1,9 @@
+2000-06-17 Dan Winship <danw@helixcode.com>
+
+ * camel-mime-parser.c (folder_scan_header): Don't copy newlines
+ into the parsed header text, and turn any number of tabs and
+ spaces after a newline into a single space.
+
2000-06-17 Jeffrey Stedfast <fejj@helixcode.com>
* providers/imap/camel-imap-folder.c (imap_init): Should now
diff --git a/camel/camel-mime-parser.c b/camel/camel-mime-parser.c
index acb29814d2..c8dc4fb61c 100644
--- a/camel/camel-mime-parser.c
+++ b/camel/camel-mime-parser.c
@@ -1102,18 +1102,34 @@ retry:
start = inptr;
- if (!s->midline
- && (part = folder_boundary_check(s, inptr, lastone))) {
- if ((s->outptr>s->outbuf) || (inptr-start))
- goto header_truncated; /* may not actually be truncated */
-
- goto normal_exit;
+ if (!s->midline) {
+ if ((part = folder_boundary_check(s, inptr, lastone))) {
+ if ((s->outptr>s->outbuf) || (inptr-start))
+ goto header_truncated; /* may not actually be truncated */
+
+ goto normal_exit;
+ }
+
+ /* Replace any number of spaces and tabs at the start of the line with
+ * a single space.
+ */
+ if (*start == ' ' || *start == '\t') {
+ static char *space = " ";
+ do
+ start++;
+ while (*start == ' ' || *start == '\t');
+ header_append(s, space, space + 1);
+ }
}
/* goto next line */
while ((*inptr++)!='\n')
;
+ g_assert(inptr<=s->inend+1);
+
+ header_append(s, start, inptr-1);
+
/* check against the real buffer end, not our 'atleast limited' end */
/* also make sure we have at least 1 char lookahead, so even if we found a \n at
the end, well, make out we didn't, and re-scan it next pass */
@@ -1124,10 +1140,6 @@ retry:
s->midline = FALSE;
}
- g_assert(inptr<=s->inend);
-
- header_append(s, start, inptr);
-
h(printf("outbuf[0] = %02x '%c' oubuf[1] = %02x '%c'\n",
s->outbuf[0], isprint(s->outbuf[0])?s->outbuf[0]:'.',
s->outbuf[1], isprint(s->outbuf[1])?s->outbuf[1]:'.'));