chiark / gitweb /
truncation: include header name in warning header
[modbot-ulm.git] / stump / bin / submission.pl
index 7ad6563b864ac675f8d55fd74e9221e4f8994a8b..fa98e930f7b3abc5978bf787126b72686b438585 100755 (executable)
@@ -276,6 +276,9 @@ sub ignoreHeader {
   return 1 if( $header =~ /^Sender:/i );
   return 1 if( $header =~ /^In-Reply-To:/i );
   return 1 if( $header =~ /^Originator:/i );
+  return 1 if( $header =~ /^X-Trace:/i );
+  return 1 if( $header =~ /^X-Complaints-To:/i );
+  return 1 if( $header =~ /^NNTP-Posting-Date:/i );
 
   return 0;
 }
@@ -339,13 +342,16 @@ sub readMessage {
        # In these cases, keep that in $readahead for now,
        # and process the previous header, which is in $_.
        # But, first, a wrinkle ...
-       push @unfolded, (m/^[^:]+:/ ? $& : '????')
-           if s/\n(?=.)/ /g;
-       if (length $_ > 505) { #wtf
-         $_ = substr($_, 0, 500);
-         $_ =~ s/\n?$/\n/;
-         $readahead = $_;
-         $_ = $warning->("Next header truncated!");
+       if (!m/^(?:References):/i) {
+         push @unfolded, (m/^[^:]+:/ ? $& : '????')
+           if s/\n(?=.)//g;
+         if (length $_ > 505) { #wtf
+           $_ = substr($_, 0, 500);
+           $_ =~ s/\n?$/\n/;
+           $readahead = $_;
+           m/^[0-9a-z-]+/i;
+           $_ = $warning->("Next header ($&) truncated!");
+         }
        }
       } else {
        # $_ is empty line at end of headers