]> diplodocus.org Git - nmh/commitdiff
Make sure we always generate a Content-ID header for message/external-body
authorKen Hornstein <kenh@pobox.com>
Thu, 12 Jan 2017 02:37:52 +0000 (21:37 -0500)
committerKen Hornstein <kenh@pobox.com>
Thu, 12 Jan 2017 03:06:31 +0000 (22:06 -0500)
entities, as required by RFC 2045.

docs/pending-release-notes
h/mhparse.h
test/mhbuild/test-ext-params
uip/mhbuildsbr.c

index 52568c1..7de2628 100644 (file)
@@ -109,3 +109,5 @@ BUG FIXES
 - repl now make sure that any Fcc header in a replied-to message is not
   copied into the outgoing draft by default, and that the -fcc switch
   actually works in the absence of a Fcc header in the replied-to message.
+- A Content-ID is generated for message/external-body entities as required
+  by RFC 2045, even if -nocontentid is supplied to mhbuild.
index d184e53..3641f7a 100644 (file)
@@ -90,6 +90,26 @@ struct cefile {
  * A struct multipart contains (among other things) a linked list
  * of struct part elements, and THOSE contain a pointer to the sub-part's
  * Content structure.
+ *
+ * An extra note for message/external-body parts.  The enclosing
+ * content structure is marked as a message/external-body; the c_ctparams
+ * contains a pointer to a struct exbody, which contains a pointer to
+ * (among other things) the "real" content (e.g., application/octet-stream).
+ * The "real" content structure has the c_ctexbody pointer back to the
+ * same struct exbody sees in the enclosing content structure (the struct
+ * exbody contains parent pointers if you need to traverse up the content
+ * structure).  Hopefully this makes it clearer:
+ *
+ * Enclosing content:
+ *   Type: message/external-body
+ *   c_ctparams: pointer to "struct exbody"
+ *   c_ctexbody: NULL
+ *
+ * "Real" content:
+ *   Type: application/octet-stream (or whatever)
+ *   c_ctparams: NULL
+ *   c_ctexbody: pointer to "struct exbody"
+ *
  */
 struct Content {
     /* source (read) file */
index 5be4514..f351716 100755 (executable)
@@ -241,13 +241,16 @@ Content-Type: message/external-body; access-type="url";
        url*1="/that-should-be-wrapped/name.tar.gz"
 
 Content-Type: application/octet-stream
+Content-ID:
 Content-Description: Test of a long URL
 Content-Disposition: attachment; filename="test.tar.gz"
 
 ------- =_aaaaaaaaaa0--
 EOF
 
-check "$draft" "$expected"
+sed -e 's/^Content-ID:.*/Content-ID:/' "$draft" > "${draft}.nocontentid"
+
+check "${draft}.nocontentid" "$expected"
 
 [ ${failed:=0} -eq 0 ]  &&  rm -f ${backup}
 
index 5607be1..2639043 100644 (file)
@@ -1725,9 +1725,11 @@ build_headers (CT ct, int header_encoding)
     add_header (ct, np, vp);
 
     /*
-     * output the Content-ID, unless disabled by -nocontentid
+     * output the Content-ID, unless disabled by -nocontentid.  Note that
+     * RFC 2045 always requires a Content-ID header for message/external-body
+     * entities.
      */
-    if (contentidsw && ct->c_id) {
+    if ((contentidsw || ct->c_ctexbody) && ct->c_id) {
        np = mh_xstrdup(ID_FIELD);
        vp = concat (" ", ct->c_id, NULL);
        add_header (ct, np, vp);