]> Sergey Matveev's repositories - public-inbox.git/commitdiff
mda: set List-ID correctly according to RFC2919
authorEric Wong <e@80x24.org>
Mon, 26 Jun 2017 03:05:39 +0000 (03:05 +0000)
committerEric Wong <e@80x24.org>
Mon, 26 Jun 2017 03:07:46 +0000 (03:07 +0000)
Oops, due to an old mistake , List-ID was set incorrectly
in the MDA.  This could cause some breakage w.r.t. mail filters.

lib/PublicInbox/MDA.pm
scripts/ssoma-replay
t/httpd.t
t/nntpd.t

index bcf5358bb6e6d7cd9e450e8f9c32c1db58f03ae1..6490102aaf8b3d52e6bcd680380a66507688fe82 100644 (file)
@@ -78,7 +78,8 @@ sub set_list_headers {
        my ($class, $simple, $dst) = @_;
        unless (defined $simple->header('List-Id')) {
                my $pa = $dst->{-primary_address};
-               $simple->header_set("List-Id", "<$pa>"); # RFC2919
+               $pa =~ tr/@/./; # RFC2919
+               $simple->header_set("List-Id", "<$pa>");
        }
 
        $simple->header_set($_) foreach @BAD_HEADERS;
index 3c3fdf4857d239fe48462ffb72bc70950bae30d0..50bf45604b19aa7acefba902ebde6c86015bb304 100755 (executable)
@@ -45,7 +45,9 @@ my $body = $msg->body;
 my $list_id = $header_obj->header('List-Id');
 my ($archive_url, $user, $domain);
 if (defined $list_id) {
-       ($user, $domain) = ($list_id =~ /<(.+)\@(.+)>/g);
+       # due to a bug in old versions of public-inbox, <user@domain> was used
+       # as the list-Id instead of <user.domain> as recommended in RFC2919
+       ($user, $domain) = ($list_id =~ /<([^\.@]+)[\.@](.+)>/g);
 
        if (defined $domain) {
                $archive_url = "https://$domain/$user/";
index c2e73608c90122c5a77246aca238a940929c740a..d0ce39432816896641b233466ff6245a9c47e134 100644 (file)
--- a/t/httpd.t
+++ b/t/httpd.t
@@ -57,7 +57,7 @@ Date: Thu, 01 Jan 1970 06:06:06 +0000
 
 nntp
 EOF
-               $mime->header_set('List-Id', "<$addr>");
+
                my $git = PublicInbox::Git->new($maindir);
                my $im = PublicInbox::Import->new($git, 'test', $addr);
                $im->add($mime);
index ad50a64fd7bb7b9d155bbdb339463db50476f72e..2ccc90fbad785254516f6c26c9e93e223e7abdda 100644 (file)
--- a/t/nntpd.t
+++ b/t/nntpd.t
@@ -62,7 +62,9 @@ Content-Transfer-Encoding: 8bit
 
 This is a test message for El\xc3\xa9anor
 EOF
-               $mime->header_set('List-Id', "<$addr>");
+               my $list_id = $addr;
+               $list_id =~ s/@/./;
+               $mime->header_set('List-Id', "<$list_id>");
                $len = length($mime->as_string);
                my $git = PublicInbox::Git->new($maindir);
                my $im = PublicInbox::Import->new($git, 'test', $addr);