diff options
author | Eric Wong <e@yhbt.net> | 2020-06-10 07:04:37 +0000 |
---|---|---|
committer | Eric Wong <e@yhbt.net> | 2020-06-13 07:55:45 +0000 |
commit | 49175649b3e49cdd5f2ac857cb91e69a5b91a739 (patch) | |
tree | 0d79deb03f67a58c2c1e6bcb5d75e004a6004e55 /t/imap.t | |
parent | 509c2cc25c8f21b4e1685de8b475629559c9b2aa (diff) | |
download | public-inbox-49175649b3e49cdd5f2ac857cb91e69a5b91a739.tar.gz |
IMAP RFC 3501 stipulates case-insensitive comparisons, and so does RFC 977 (NNTP). However, INN (nnrpd) uses case-sensitive comparisons, so we've always used case-sensitive comparisons for NNTP to match nnrpd behavior. Unfortunately, some IMAP clients insist on sending "INBOX" with caps, which causes problems for us. Since NNTP group names are typically all lowercase anyways, just force all comparisons to lowercase for IMAP and warn admins if uppercase-containing newsgroups won't be accessible over IMAP. This ensures our existing -nntpd behavior remains unchanged while being compatible with the expectations of real-world IMAP clients.
Diffstat (limited to 't/imap.t')
-rw-r--r-- | t/imap.t | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -8,9 +8,14 @@ use PublicInbox::IMAP; use PublicInbox::IMAPD; { # make sure we get '%' globbing right - my @n = map { { newsgroup => $_ } } (qw(x.y.z x.z.y)); + my @w; + local $SIG{__WARN__} = sub { push @w, @_ }; + my @n = map { { newsgroup => $_ } } (qw(x.y.z x.z.y IGNORE.THIS)); my $self = { imapd => { grouplist => \@n } }; PublicInbox::IMAPD::refresh_inboxlist($self->{imapd}); + is(scalar(@w), 1, 'got a warning for upper-case'); + like($w[0], qr/IGNORE\.THIS/, 'warned about upper-case'); + my $res = PublicInbox::IMAP::cmd_list($self, 'tag', 'x', '%'); is(scalar($$res =~ tr/\n/\n/), 2, 'only one result'); like($$res, qr/ x\r\ntag OK/, 'saw expected'); |