From 69950995bed9305ebc6dabab64f017b544bc8f1e Mon Sep 17 00:00:00 2001 From: Eduardo Chappa Date: Tue, 1 Jan 2019 10:44:27 -0700 Subject: * Some servers report the encoding of a message/rfc822 as 8bit, and because of that, Alpine sets their encoding to quoted-printable, in contradiction to RFC 2045. We handle this by keeping the encoding reported by the server. Based on a report by Holger Trapp. --- pith/send.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'pith/send.c') diff --git a/pith/send.c b/pith/send.c index e72b6d98..b7243859 100644 --- a/pith/send.c +++ b/pith/send.c @@ -4520,21 +4520,24 @@ pine_write_body_header(struct mail_bodystruct *body, soutr_t f, void *s) if(!pine_write_params(body->parameter, so)) return(pwbh_finish(0, so)); } - else if(!so_puts(so, "; CHARSET=US-ASCII")) + else if ((body->type != TYPEMESSAGE + || (body->subtype && strucmp(body->subtype, "RFC822"))) + && (!so_puts(so, "; CHARSET=US-ASCII"))) return(pwbh_finish(0, so)); if(!so_puts(so, "\015\012")) return(pwbh_finish(0, so)); + /* do not change the encoding of a TYPEMESSAGE part */ if ((body->encoding /* note: encoding 7BIT never output! */ && !(so_puts(so, "Content-Transfer-Encoding: ") && so_puts(so, body_encodings[(body->encoding==ENCBINARY) - ? ENCBASE64 - : (body->encoding == ENC8BIT) - ? ENCQUOTEDPRINTABLE - : (body->encoding <= ENCMAX) - ? body->encoding - : ENCOTHER]) + ? (body->type == TYPEMESSAGE ? ENCBINARY : ENCBASE64) + : (body->encoding == ENC8BIT) + ?(body->type == TYPEMESSAGE ? ENC8BIT : ENCQUOTEDPRINTABLE) + : (body->encoding <= ENCMAX) + ? body->encoding + : ENCOTHER]) && so_puts(so, "\015\012"))) /* * If requested, strip Content-ID headers that don't look like they -- cgit v1.2.3-54-g00ecf