aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Net/IMAP/InterIMAP.pm
diff options
context:
space:
mode:
authorGuilhem Moulin <guilhem@fripost.org>2021-02-22 17:54:33 +0100
committerGuilhem Moulin <guilhem@fripost.org>2021-02-22 18:03:28 +0100
commit48d35e65472e29d808a4bf604b7f99270496b810 (patch)
tree4dfce53c50aa7d7213914551fd14c62d00e6fb38 /lib/Net/IMAP/InterIMAP.pm
parent75d983baba64e065e39b3e2a8b848117fe1bfc66 (diff)
Improve message for unknown untagged UIDNEXT response.
Per RFC3501 §6.3.1 and §6.3.2 ‘UIDNEXT’ must be returned in an OK untagged response. See also Appendix B#34. However §6.3.1 suggests that it's in fact optional: “If this is missing, the client can not make any assumptions about the next unique identifier value.” A correction was proposed in Errata ID 3445 https://www.rfc-editor.org/errata/eid3445 , and rejected on the ground that clients SHOULD support the implement default behavior for missing data. We heavily rely on the ‘UIDNEXT’ presence and won't implement a workaround for its absence; instead we panic() with a more informative message.
Diffstat (limited to 'lib/Net/IMAP/InterIMAP.pm')
-rw-r--r--lib/Net/IMAP/InterIMAP.pm3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/Net/IMAP/InterIMAP.pm b/lib/Net/IMAP/InterIMAP.pm
index a171554..56164cf 100644
--- a/lib/Net/IMAP/InterIMAP.pm
+++ b/lib/Net/IMAP/InterIMAP.pm
@@ -1312,7 +1312,8 @@ sub pull_new_messages($$&@) {
# 2^32-1: don't use '*' since the highest UID can be known already
$range .= "$since:4294967295";
- $UIDNEXT = $cache->{UIDNEXT} // $self->panic(); # sanity check
+ $UIDNEXT = $cache->{UIDNEXT} //
+ $self->panic("Unknown UIDNEXT value - non-compliant server?");
$self->fetch($range, "($attrs)", sub($) {
my $mail = shift;
$UIDNEXT = $mail->{UID} + 1 if $UIDNEXT <= $mail->{UID};