]> diplodocus.org Git - nmh/commitdiff
Specifically look for Content-Type header in converted content.
authorDavid Levine <levinedl@acm.org>
Tue, 6 Jan 2015 04:32:00 +0000 (22:32 -0600)
committerDavid Levine <levinedl@acm.org>
Tue, 6 Jan 2015 04:32:00 +0000 (22:32 -0600)
uip/mhbuildsbr.c

index 850ec8f8ac699f78096ae284701c92e6b0236ba1..dde5027cb78dfc186f51243bf35d113af0b9b13d 100644 (file)
@@ -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. */
 
                 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. */
                     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. */
     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) {
     }
 
     if (found_header) {