mailpost: References header is too long

Julien ÉLIE julien at trigofacile.com
Sun Mar 21 13:54:11 UTC 2010


Hi Harald,

> A hack around this was easy to implement (see attachment),
> but I would like to know the story behind this. Most EMails
> forwarded to the news got just a single entry in the
> References field. How comes that a few got tons of
> references? Is this a user error?

Did you try to see whether it is always the same agent that
generates these mails?
As I quoted it from RFC 5322, there is no limit for the length
of the References: header field in mail.  But when injected
into news, the field should be trimmed.  Thanks for your report!

I used 985 instead of 990:

+        # 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;
+            }
+        }

-- 
Julien ÉLIE

« Plus un ordinateur possède de RAM, plus vite il peut générer un message d'erreur. » 




More information about the inn-workers mailing list