#include <h/mh.h>
#include <fcntl.h>
-#include <h/signals.h>
#include <h/md5.h>
#include <h/mts.h>
#include <h/tws.h>
}
m_getfld_state_destroy (&gstate);
- /*
- * Iterate through the list of headers and call the function to MIME-ify
- * them if required.
- */
+ if (header_encoding != CE_8BIT) {
+ /*
+ * Iterate through the list of headers and call the function to MIME-ify
+ * them if required.
+ */
- for (hp = ct->c_first_hf; hp != NULL; hp = hp->next) {
- if (encode_rfc2047(hp->name, &hp->value, header_encoding, NULL)) {
- adios(NULL, "Unable to encode header \"%s\"", hp->name);
- }
+ for (hp = ct->c_first_hf; hp != NULL; hp = hp->next) {
+ if (encode_rfc2047(hp->name, &hp->value, header_encoding, NULL)) {
+ adios(NULL, "Unable to encode header \"%s\"", hp->name);
+ }
+ }
}
/*
* Decide what to check while scanning this content. Note that
* for text content we always check for 8bit characters if the
* charset is unspecified, because that controls whether or not the
- * character set is us-ascii or retrieved from the locale.
+ * character set is us-ascii or retrieved from the locale. And
+ * we check even if the charset is specified, to allow setting
+ * the proper Content-Transfer-Encoding.
*/
if (ct->c_type == CT_TEXT) {
t = (struct text *) ct->c_ctparams;
if (t->tx_charset == CHARSET_UNSPECIFIED) {
- check8bit = 1;
checknul = 1;
}
+ check8bit = 1;
}
switch (ct->c_reqencoding) {
if (ct->c_descr) {
np = add (DESCR_FIELD, NULL);
vp = concat (" ", ct->c_descr, NULL);
- if (encode_rfc2047(DESCR_FIELD, &vp, header_encoding, NULL))
- adios(NULL, "Unable to encode %s header", DESCR_FIELD);
+ if (header_encoding != CE_8BIT) {
+ if (encode_rfc2047(DESCR_FIELD, &vp, header_encoding, NULL)) {
+ adios(NULL, "Unable to encode %s header", DESCR_FIELD);
+ }
+ }
add_header (ct, np, vp);
}
struct str2init *s2i;
CT reply_ct;
struct part *part;
+ int status;
type_p = getcpy (type);
if ((subtype_p = strchr (type_p, '/'))) {
/* Convert here . . . */
ct->c_storeproc = getcpy (convert_command);
ct->c_umask = ~m_gmprot ();
- if (show_content_aux (ct, 0, convert_command, NULL, NULL) == NOTOK) {
+
+ if ((status = show_content_aux (ct, 0, convert_command, NULL, NULL)) !=
+ OK) {
admonish (NULL, "store of %s content failed", type);
}
free (convert_command);
} else {
set_charset (reply_ct, -1);
charset = get_param (reply_ct->c_ctinfo.ci_first_pm, "charset", '?', 1);
- if (reply_ct->c_reqencoding == CE_UNKNOWN) {
- /* Assume that 8bit is sufficient (for text). */
- reply_ct->c_reqencoding =
- strcasecmp (charset, "US-ASCII") ? CE_8BIT : CE_7BIT;
- }
}
/* Concatenate text/plain parts. */
/* Make sure that the charset is set in the text/plain
part. */
set_charset (*text_plain_ct, -1);
- if ((*text_plain_ct)->c_reqencoding == CE_UNKNOWN) {
- /* Assume that 8bit is sufficient (for text). */
- (*text_plain_ct)->c_reqencoding =
- strcasecmp (charset, "US-ASCII") ? CE_8BIT : CE_7BIT;
- }
}
if (*text_plain_ct) {
buffer[statbuf.st_size] = '\0';
/* Look for a header in the convert reply. */
- if (strncasecmp (buffer, TYPE_FIELD, sizeof TYPE_FIELD) == 0 &&
- buffer[sizeof TYPE_FIELD] == ':') {
+ if (strncasecmp (buffer, TYPE_FIELD, strlen (TYPE_FIELD)) == 0 &&
+ buffer[strlen (TYPE_FIELD)] == ':') {
if ((end_of_header = strstr (buffer, "\r\n\r\n"))) {
end_of_header += 2;
found_header = 1;