]> diplodocus.org Git - nmh/commitdiff
output_content() assumed that ci->ci_values[0] was the boundary,
authorDavid Levine <levinedl@acm.org>
Thu, 7 Feb 2013 02:28:29 +0000 (20:28 -0600)
committerDavid Levine <levinedl@acm.org>
Thu, 7 Feb 2013 02:28:29 +0000 (20:28 -0600)
but that's not always the case.  Added search for the boundary
in ci->ci_attrs[].

uip/mhoutsbr.c

index 59bf7a429e36bafde130923128e730cf723afbef..d3a0a85b656ae8da038bf66cd4723fe06ee0c6cd 100644 (file)
@@ -83,6 +83,14 @@ output_content (CT ct, FILE *out)
 {
     int result = 0;
     CI ci = &ct->c_ctinfo;
 {
     int result = 0;
     CI ci = &ct->c_ctinfo;
+    char *boundary = ci->ci_values[0], **ap, **vp;
+
+    for (ap = ci->ci_attrs, vp = ci->ci_values; *ap; ++ap, ++vp) {
+        if (! mh_strcasecmp ("boundary", *ap)) {
+            boundary = *vp;
+            break;
+        }
+    }
 
     /*
      * Output all header fields for this content
 
     /*
      * Output all header fields for this content
@@ -113,11 +121,11 @@ output_content (CT ct, FILE *out)
        for (part = m->mp_parts; part; part = part->mp_next) {
            CT p = part->mp_part;
 
        for (part = m->mp_parts; part; part = part->mp_next) {
            CT p = part->mp_part;
 
-           fprintf (out, "\n--%s\n", ci->ci_values[0]);
+           fprintf (out, "\n--%s\n", boundary);
            if (output_content (p, out) == NOTOK)
                return NOTOK;
        }
            if (output_content (p, out) == NOTOK)
                return NOTOK;
        }
-       fprintf (out, "\n--%s--\n", ci->ci_values[0]);
+       fprintf (out, "\n--%s--\n", boundary);
     }
     break;
 
     }
     break;