On Friday 18 May 2007 05:48:22 Mark Martinec wrote:
> Anant Nitya,
>
> > I have enabled __ sa_spam_report_header = 1 __ in my amavisd.conf, it
> > works for few and produces broken text for others.
> > amavisd-new-2.5.0, perl 5.8.8
> >
> > [BROKEN REPORT HEADER]
> > X-Spam-Status: Yes, score=47.791 required=6 tests=[BAYES_99=3.5,
> > DCC_CHECK=2.17, DIGEST_MULTIPLE=0.765, DNS_FROM_RFC_WHOIS=1.447,
> > HTML_40_50=0.496, HTML_MESSAGE=0.001, PYZOR_CHECK=3.7,
> >...
> > X-Spam-Report:
> > =?iso-8859-1?Q?=0A=0A*__1=2E0_RELAY=5FRU_=C2=A0_=C2=A0_=C2=A0_Relayed_thr
> >?=
> > =?iso-8859-1?Q?ough_Russia=0A*__0=2E5_HTML=5F40=5F50_BODY=3A_Message_is_4
> >?=
> > =?iso-8859-1?Q?0=25_to_50=25_HTML=0A*__0=2E0_HTML=5FMESSAGE_BODY=3A_HTML_
> >?= ...
>
> I presume the X-Spam-Report was wrapped by your posting, and was originally
> contained in one long header line (not longer than 998 characters).
>
> So what remains is inapproriate rfc2047-quoting of newlines, and
> unnecessary quoting of those lines not containing 8-bit characters,
> which lead to an ugly and difficult-to-read information in a header.
>
> Note that 8-bit characters are not allowed in a header,
> so some form of quoting or sanitation can not be avoided.
>
> The following patch should fix it:
>
> --- amavisd~ Mon Apr 23 05:25:30 2007
> +++ amavisd Fri May 18 02:08:21 2007
> @@ -1847,6 +1847,7 @@
> my($head,$rest,$tail) = ($1,$2,$3);
> # Q-encode $rest according to RFC 2047
> - # more restricted than =?_ so that it may be used in 'phrase'
> - $rest =~ s{([^ 0-9a-zA-Z!*/+-])}{sprintf('=%02X',ord($1))}egs;
> +# # more restricted than =?_ so that it may be used in 'phrase'
> +# $rest =~ s{([^ 0-9a-zA-Z!*/+-])}{sprintf('=%02X',ord($1))}egs;
> + $rest =~
> s{([^\001-\011\013\014\016-\177])}{sprintf('=%02X',ord($1))}egs; $rest =~
> tr/ /_/; # turn spaces into _ (rfc2047 allows it)
> my($s) = $head; my($len) = 75 - (length($prefix)+length($suffix)) - 2;
> @@ -5396,10 +5397,9 @@
> }
> my($qb) = c('hdr_encoding_qb');
> - if (uc($qb) eq 'Q') {
> - $field_body = q_encode($field_body_octets, $qb, c('hdr_encoding'));
> - } else {
> - $field_body = MIME::Words::encode_mimeword($field_body_octets,
> - $qb, c('hdr_encoding'));
> - }
> + my($encoder_func) = uc($qb) eq 'Q' ? \&q_encode
> + : \&MIME::Words::encode_mimeword;
> + $field_body = join("\n", map { /^[\001-\011\013\014\016-\177]*\z/ ? $_
> : +
> &$encoder_func($_,$qb,c('hdr_encoding')) } +
> split(/\n/, $field_body_octets, -1)); } else { # supposed to be in plain
> ASCII, let's make sure it is $field_body = safe_encode('ascii',
> $field_body);
Thanks it solves the problem.
--
As a lamp in a windless place does not waver, so the transcendentalist,
whose mind is illuminated in self , remains always steady in meditation
on the transcendence.
-- Gita Sutra Of Mysticism
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
AMaViS-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/amavis-user
AMaViS-FAQ:http://www.amavis.org/amavis-faq.php3
AMaViS-HowTos:http://www.amavis.org/howto/