INN commit: trunk/frontends (mailpost.in)
INN Commit
rra at isc.org
Fri Mar 19 22:17:31 UTC 2010
Date: Friday, March 19, 2010 @ 15:17:30
Author: iulius
Revision: 9020
mailpost should trim the References: header field when it is too long.
Otherwise, inews rejects the article.
RFC 5537 explains how to trim it.
Original patch from Harald Dunkel.
Modified:
trunk/frontends/mailpost.in
-------------+
mailpost.in | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
Modified: mailpost.in
===================================================================
--- mailpost.in 2010-03-19 21:27:15 UTC (rev 9019)
+++ mailpost.in 2010-03-19 22:17:30 UTC (rev 9020)
@@ -252,8 +252,24 @@
}
if (/^References:\s*/sio) {
- $references = $';
- next;
+ $references = $';
+
+ # 986 = 998 (maximum per RFC 5536) - length("References: ")
+ if (length($references) > 985) {
+ my @refarray = ( $references =~ /(<.*?>)/g );
+ # Keep only the first and the last two message-IDs, per RFC 5537.
+ #
+ # Remove the header in case we do not have at least 3 message-IDs
+ # because it then probably means that the header is broken, or
+ # contains CFWS that we do not deal with.
+ if (scalar(@refarray) > 2) {
+ my $last_mid = pop(@refarray);
+ $references = shift(@refarray) . ' ' . pop(@refarray) . ' ' . $last_mid;
+ } else {
+ $references = undef;
+ }
+ }
+ next;
}
if (!defined($references) && /^In-Reply-To:[^\<]*\<([^\>]+)\>/sio) {
More information about the inn-committers
mailing list