+ /* Current versions of the code only understand a single arg to these
+ * headers. This is a bug at the level they work at but suffices for
+ * DisOrder's current purposes. */
+
+ insist(!mime_rfc2388_content_disposition(
+ "attachment; filename=genome.jpeg;\n"
+ "modification-date=\"Wed, 12 Feb 1997 16:29:51 -0500\"",
+ &t, &n, &v));
+ check_string(t, "attachment");
+ check_string(n, "filename");
+ check_string(v, "genome.jpeg");
+
+ vector_init(parts);
+ insist(mime_multipart("--outer\r\n"
+ "Content-Type: text/plain\r\n"
+ "Content-Disposition: inline\r\n"
+ "Content-Description: text-part-1\r\n"
+ "\r\n"
+ "Some text goes here\r\n"
+ "\r\n"
+ "--outer\r\n"
+ "Content-Type: multipart/mixed; boundary=inner\r\n"
+ "Content-Disposition: attachment\r\n"
+ "Content-Description: multipart-2\r\n"
+ "\r\n"
+ "--inner\r\n"
+ "Content-Type: text/plain\r\n"
+ "Content-Disposition: inline\r\n"
+ "Content-Description: text-part-2\r\n"
+ "\r\n"
+ "Some more text here.\r\n"
+ "\r\n"
+ "--inner\r\n"
+ "Content-Type: image/jpeg\r\n"
+ "Content-Disposition: attachment\r\n"
+ "Content-Description: jpeg-1\r\n"
+ "\r\n"
+ "<jpeg data>\r\n"
+ "--inner--\r\n"
+ "--outer--\r\n",
+ test_multipart_callback,
+ "outer",
+ parts) == 0);
+ check_integer(parts->nvec, 2);
+ check_string(parts->vec[0],
+ "Content-Type: text/plain\r\n"
+ "Content-Disposition: inline\r\n"
+ "Content-Description: text-part-1\r\n"
+ "\r\n"
+ "Some text goes here\r\n");
+ check_string(parts->vec[1],
+ "Content-Type: multipart/mixed; boundary=inner\r\n"
+ "Content-Disposition: attachment\r\n"
+ "Content-Description: multipart-2\r\n"
+ "\r\n"
+ "--inner\r\n"
+ "Content-Type: text/plain\r\n"
+ "Content-Disposition: inline\r\n"
+ "Content-Description: text-part-2\r\n"
+ "\r\n"
+ "Some more text here.\r\n"
+ "\r\n"
+ "--inner\r\n"
+ "Content-Type: image/jpeg\r\n"
+ "Content-Disposition: attachment\r\n"
+ "Content-Description: jpeg-1\r\n"
+ "\r\n"
+ "<jpeg data>\r\n"
+ "--inner--");
+ /* No trailing CRLF is _correct_ - see RFC2046 5.1.1 note regarding CRLF
+ * preceding the boundary delimiter line. An implication of this is that we
+ * must cope with partial lines at the end of the input when recursively
+ * decomposing a multipart message. */
+ vector_init(parts);
+ insist(mime_multipart("--inner\r\n"
+ "Content-Type: text/plain\r\n"
+ "Content-Disposition: inline\r\n"
+ "Content-Description: text-part-2\r\n"
+ "\r\n"
+ "Some more text here.\r\n"
+ "\r\n"
+ "--inner\r\n"
+ "Content-Type: image/jpeg\r\n"
+ "Content-Disposition: attachment\r\n"
+ "Content-Description: jpeg-1\r\n"
+ "\r\n"
+ "<jpeg data>\r\n"
+ "--inner--",
+ test_multipart_callback,
+ "inner",
+ parts) == 0);
+ check_integer(parts->nvec, 2);
+ check_string(parts->vec[0],
+ "Content-Type: text/plain\r\n"
+ "Content-Disposition: inline\r\n"
+ "Content-Description: text-part-2\r\n"
+ "\r\n"
+ "Some more text here.\r\n");
+ check_string(parts->vec[1],
+ "Content-Type: image/jpeg\r\n"
+ "Content-Disposition: attachment\r\n"
+ "Content-Description: jpeg-1\r\n"
+ "\r\n"
+ "<jpeg data>");
+