From: David Levine Date: Tue, 6 Jan 2015 04:32:00 +0000 (-0600) Subject: Specifically look for Content-Type header in converted content. X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/6b073f7b67a0afd64012ff7d00818ec1bd07b5f2?ds=sidebyside;hp=d7a9b5aa35f81e680a54a2f7c2b7dab749812cef Specifically look for Content-Type header in converted content. --- diff --git a/uip/mhbuildsbr.c b/uip/mhbuildsbr.c index 850ec8f8..dde5027c 100644 --- a/uip/mhbuildsbr.c +++ b/uip/mhbuildsbr.c @@ -2323,6 +2323,7 @@ expand_pseudoheader (CT ct, CT *text_plain_ct, struct multipart *m, if (text_plain_reply != NOTOK && addl_reply != NOTOK) { /* Insert blank line before each addl part. */ + /* It would be nice not to do this for the first one. */ if (write (text_plain_reply, "\n", 1) == 1) { /* Copy the text from the new reply and then free its Content struct. */ @@ -2386,12 +2387,15 @@ extract_headers (CT ct, char *reply_file, FILE **reply_fp) { buffer[statbuf.st_size] = '\0'; /* Look for a header in the convert reply. */ - if ((end_of_header = strstr (buffer, "\r\n\r\n"))) { - end_of_header += 2; - found_header = 1; - } else if ((end_of_header = strstr (buffer, "\n\n"))) { - ++end_of_header; - found_header = 1; + if (strncasecmp (buffer, TYPE_FIELD, sizeof TYPE_FIELD) == 0 && + buffer[sizeof TYPE_FIELD] == ':') { + if ((end_of_header = strstr (buffer, "\r\n\r\n"))) { + end_of_header += 2; + found_header = 1; + } else if ((end_of_header = strstr (buffer, "\n\n"))) { + ++end_of_header; + found_header = 1; + } } if (found_header) {