-.TH MHFIXMSG %manext1% "October 1, 2016" "%nmhversion%"
+.TH MHFIXMSG %manext1% "October 3, 2016" "%nmhversion%"
.\"
.\" %nmhwarning%
.\"
.B \-fixcte
switch enables a transformation to change the
Content-Transfer-Encoding from an invalid value to 8bit in message
-parts with a Content-Type of multipart, as required by RFC 2045,
-§6.4. That condition is indicated by a \*(lqmust be encoded in
-7bit, 8bit, or binary\*(rq error message from
+parts with a Content-Type of multipart and message, as required by
+RFC 2045, §6.4. That condition is indicated by a \*(lqmust be
+encoded in 7bit, 8bit, or binary\*(rq error message from
.B mhlist
and other
.B nmh
\-textcharset text/plain parts
\-reformat text parts that are not text/plain
\-fixboundary outermost multipart part
-\-fixcte multipart part
+\-fixcte multipart or message part
\-fixtype all except multipart and message parts
.fi
.RE
Content-Type: multipart/mixed; boundary=001a114dd3e8fe9c56053d92f414
--001a114dd3e8fe9c56053d92f414
-
Content-Type: text/plain; charset=UTF-8
This is a test.
---001a114dd3e8fe9c4a053d92f412--
-
--001a114dd3e8fe9c56053d92f414
Content-Type: text/plain; charset="UTF-8"; name*=UTF-8''test%C3%B8.txt
Content-Disposition: attachment; filename*=UTF-8''test%C3%B8.txt
Content-Type: multipart/mixed; boundary=001a114dd3e8fe9c56053d92f414
--001a114dd3e8fe9c56053d92f414
-
Content-Type: text/plain; charset=UTF-8
This is a test.
---001a114dd3e8fe9c4a053d92f412--
-
--001a114dd3e8fe9c56053d92f414
Content-Type: text/plain; charset=UTF-8; name="=?UTF-8?B?dGVzdMO4LnR4dA==?="
Content-Disposition: attachment; filename="=?UTF-8?B?dGVzdMO4LnR4dA==?="
X("noreplacetextplain", 0, NREPLACETEXTPLAINSW) \
X("fixboundary", 0, FIXBOUNDARYSW) \
X("nofixboundary", 0, NFIXBOUNDARYSW) \
- X("fixcte", 0, FIXCTESW) \
- X("nofixcte", 0, NFIXCTESW) \
+ X("fixcte", 0, FIXCOMPOSITECTESW) \
+ X("nofixcte", 0, NFIXCOMPOSITECTESW) \
X("fixtype mimetype", 0, FIXTYPESW) \
X("file file", 0, FILESW) \
X("outfile file", 0, OUTFILESW) \
*/
typedef struct fix_transformations {
int fixboundary;
- int fixcte;
+ int fixcompositecte;
svector_t fixtypes;
int reformat;
int replacetextplain;
static int fix_types (CT, svector_t, int *);
static char *replace_substring (char **, const char *, const char *);
static char *remove_parameter (char *, const char *);
-static int fix_multipart_cte (CT, int *);
+static int fix_composite_cte (CT, int *);
static int set_ce (CT, int);
static int ensure_text_plain (CT *, CT, int *, int);
static int find_textplain_sibling (CT, int, int *);
int chgflag = 1;
int status = OK;
fix_transformations fx;
- fx.reformat = fx.fixcte = fx.fixboundary = 1;
+ fx.reformat = fx.fixcompositecte = fx.fixboundary = 1;
fx.fixtypes = NULL;
fx.replacetextplain = 0;
fx.decodetext = CE_8BIT;
case NFIXBOUNDARYSW:
fx.fixboundary = 0;
continue;
- case FIXCTESW:
- fx.fixcte = 1;
+ case FIXCOMPOSITECTESW:
+ fx.fixcompositecte = 1;
continue;
- case NFIXCTESW:
- fx.fixcte = 0;
+ case NFIXCOMPOSITECTESW:
+ fx.fixcompositecte = 0;
continue;
case FIXTYPESW:
if (! (cp = *argp++) || (*cp == '-' && cp[1])) {
if (status == OK && fx->fixtypes != NULL) {
status = fix_types (*ctp, fx->fixtypes, &message_mods);
}
- if (status == OK && fx->fixcte) {
- status = fix_multipart_cte (*ctp, &message_mods);
+ if (status == OK && fx->fixcompositecte) {
+ status = fix_composite_cte (*ctp, &message_mods);
}
if (status == OK && fx->reformat) {
status =
/*
- * Fix Content-Transfer-Encoding.
+ * Fix Content-Transfer-Encoding of composite,, e.g., message or multipart, part.
+ * According to RFC 2045 Sec. 6.4, it must be 7bit, 8bit, or binary. Set it to
+ * 8 bit.
*/
static int
-fix_multipart_cte (CT ct, int *message_mods) {
+fix_composite_cte (CT ct, int *message_mods) {
int status = OK;
- if (ct->c_type == CT_MULTIPART) {
- struct multipart *m;
- struct part *part;
-
+ if (ct->c_type == CT_MESSAGE || ct->c_type == CT_MULTIPART) {
if (ct->c_encoding != CE_7BIT && ct->c_encoding != CE_8BIT &&
ct->c_encoding != CE_BINARY) {
HF hf;
set_ce (ct, CE_8BIT);
}
- m = (struct multipart *) ct->c_ctparams;
- for (part = m->mp_parts; part; part = part->mp_next) {
- if (fix_multipart_cte (part->mp_part, message_mods) != OK) {
- status = NOTOK;
- break;
+ if (ct->c_type == CT_MULTIPART) {
+ struct multipart *m;
+ struct part *part;
+
+ m = (struct multipart *) ct->c_ctparams;
+ for (part = m->mp_parts; part; part = part->mp_next) {
+ if (fix_composite_cte (part->mp_part, message_mods) != OK) {
+ status = NOTOK;
+ break;
+ }
}
}
}