]> Sergey Matveev's repositories - public-inbox.git/commitdiff
mda: match List-Id insensitively
authorEric Wong <e@80x24.org>
Mon, 21 Sep 2020 20:58:09 +0000 (20:58 +0000)
committerEric Wong <e@80x24.org>
Sat, 26 Dec 2020 19:30:55 +0000 (19:30 +0000)
This follows -watch commit b70473ab8296d31ebb600adb4fa8fe0ac5935ca8
to match List-Id headers case-insensitively.

Reported-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
Link: https://public-inbox.org/meta/20200921180152.uyqluod7qxbwqubo@chatter.i7.local/
(cherry picked from commit 8b06cda3a3af3f0e88b599a01f03edb7fec4f2c4)

lib/PublicInbox/Config.pm
t/mda.t

index abc525dbbd5dca1cb6cb9e6c2adac0a4104d6f36..d57c361ad90cd8364629201021b485c7b715cb46 100644 (file)
@@ -424,8 +424,9 @@ EOF
                $self->{-no_obfuscate}->{$lc_addr} = 1;
        }
        if (my $listids = $ibx->{listid}) {
+               # RFC2919 section 6 stipulates "case insensitive equality"
                foreach my $list_id (@$listids) {
-                       $self->{-by_list_id}->{$list_id} = $ibx;
+                       $self->{-by_list_id}->{lc($list_id)} = $ibx;
                }
        }
        if (my $ng = $ibx->{newsgroup}) {
diff --git a/t/mda.t b/t/mda.t
index c7caf3e0cca455e3eb40088492b62f26f167ecc4..c5b35eec21cf40d30a5c0dc2abc829afab7b05d5 100644 (file)
--- a/t/mda.t
+++ b/t/mda.t
@@ -261,7 +261,7 @@ Subject: this message will be trained as spam
 Date: Thu, 01 Jan 1970 00:00:00 +0000
 
 EOF
-       xsys(qw(git config --file), $pi_config, "$cfgpfx.listid", $list_id);
+       xsys(qw(git config --file), $pi_config, "$cfgpfx.listid", uc $list_id);
        $? == 0 or die "failed to set listid $?";
        ok(run_script(['-mda'], undef, { 0 => \$in }),
                'mda OK with List-Id match');