mmime: allow to relax body line length limit

Message-Id: <10e22a318b5c70d89432d85ecd8cb8ce1796a51d.1643116719.git.lucas@sexy.is>
pull/222/head
Lucas 2 years ago committed by Leah Neukirchen
parent fa27d73ddd
commit e951b0ba27

@ -46,6 +46,13 @@ Override Content-Type for the toplevel part.
Defaults to Defaults to
.Sq Li multipart/mixed . .Sq Li multipart/mixed .
.El .El
.Sh ENVIRONMENT
.Bl -tag -width Ds
.It Ev MBLAZE_RELAXED_MIME
If set,
.Ic Nm Fl c
will relax the body line length check and only consider bodies with lines
longer than 998 characters need to be MIME formatted.
.Sh EXIT STATUS .Sh EXIT STATUS
.Ex -std .Ex -std
.Sh SEE ALSO .Sh SEE ALSO

@ -517,6 +517,7 @@ check()
off_t linelen = 0; off_t linelen = 0;
off_t maxheadlinelen = 0; off_t maxheadlinelen = 0;
off_t maxbodylinelen = 0; off_t maxbodylinelen = 0;
off_t bodylinelenlimit = getenv("MBLAZE_RELAXED_MIME") ? 998 : 78;
int c; int c;
int l = -1; int l = -1;
@ -554,7 +555,7 @@ check()
} }
if (bitlow == 0 && bithigh == 0 && if (bitlow == 0 && bithigh == 0 &&
maxheadlinelen < 998 && maxbodylinelen <= 78 && maxheadlinelen < 998 && maxbodylinelen <= bodylinelenlimit &&
l == '\n') l == '\n')
return 0; return 0;
else else

@ -2,7 +2,7 @@
cd ${0%/*} cd ${0%/*}
. ./lib.sh . ./lib.sh
plan 17 plan 19
cat <<EOF >tmp cat <<EOF >tmp
References: <aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa@a> <bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb@b> <ccccccccccccccccccccccccccccccc@c> References: <aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa@a> <bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb@b> <ccccccccccccccccccccccccccccccc@c>
@ -124,3 +124,13 @@ Subject: inclusion without further content
EOF EOF
check 'no empty parts are generated after inclusion lines' '! mmime <tmp2 | mshow -t - | grep -q size=0' check 'no empty parts are generated after inclusion lines' '! mmime <tmp2 | mshow -t - | grep -q size=0'
cat <<EOF >tmp2
Subject: Strict mode
Body with lines longer than 78 characters
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
EOF
check 'body lines longer than 78 characters needs MIME formatting' '! mmime -c <tmp2'
check 'MBLAZE_RELAXED_MIME allows body lines longer than 78 characters' 'MBLAZE_RELAXED_MIME= mmime -c <tmp2'

Loading…
Cancel
Save