Opened 15 years ago

Closed 15 years ago

#2695 defect closed fixed (fixed)

IMAP4Client breaks if server uses CONDSTORE

Reported by: slamb Owned by: Jean-Paul Calderone
Priority: highest Milestone:
Component: mail Keywords:
Cc: slamb, therve Branch:
Author:

Description

My Cyrus server's capabilities line looks like this:

* OK [CAPABILITY IMAP4 IMAP4rev1 LITERAL+ ID STARTTLS] hobbes.slamb.org Cyrus IMAP4 v2.3.7-Invoca-RPM-2.3.7-4.centos4.slamb server ready
1 capability
* CAPABILITY IMAP4 IMAP4rev1 LITERAL+ ID STARTTLS ACL RIGHTS=kxte QUOTA MAILBOX-REFERRALS NAMESPACE UIDPLUS NO_ATOMIC_RENAME UNSELECT CHILDREN MULTIAPPEND BINARY SORT SORT=MODSEQ THREAD=ORDEREDSUBJECT THREAD=REFERENCES ANNOTATEMORE CATENATE CONDSTORE IDLE LISTEXT LIST-SUBSCRIBED X-NETSCAPE URLAUTH
1 OK Completed

Note the RFC:4551 stuff: CONDSTORE SORT SORT=MODSEQ. As of latest imap4.py (lastchangerev [18812]), this doesn't breaks IMAP4Client:

          File "/usr/lib64/python2.4/site-packages/twisted/mail/imap4.py", line 2300, in __cbCapabilities
            caps.setdefault(cap[:eq], []).append(cap[eq+1:])
        exceptions.AttributeError: 'NoneType' object has no attribute 'append'

Here's a fix, but I don't have unit tests right now. Note I decided to keep the cap unchanged if, say, SORT=MODSEQ precedes SORT.

--- imap4.py    (revision 20482)
+++ imap4.py    (working copy)
@@ -2295,7 +2295,7 @@
             for cap in rest:
                 eq = cap.find('=')
                 if eq == -1:
-                    caps[cap] = None
+                    caps[cap] = caps.get(cap, [])
                 else:
                     caps.setdefault(cap[:eq], []).append(cap[eq+1:])
         self._capCache = caps

Attachments (1)

imap4.diff (803 bytes) - added by bkirsch 15 years ago.
This is the same diff as the previous post except that is preserves the current external Twisted Capabilities API

Download all attachments as: .zip

Change History (6)

comment:1 Changed 15 years ago by slamb

Cc: slamb added

Changed 15 years ago by bkirsch

Attachment: imap4.diff added

This is the same diff as the previous post except that is preserves the current external Twisted Capabilities API

comment:2 Changed 15 years ago by Jean-Paul Calderone

Keywords: review added
Owner: Jean-Paul Calderone deleted

Fixed in imap4-mixed-capabilities-2695

comment:3 Changed 15 years ago by Jean-Paul Calderone

Priority: normalhighest

comment:4 Changed 15 years ago by therve

Cc: therve added
Keywords: review removed
Owner: set to Jean-Paul Calderone

I didn't spot any problem, please merge.

comment:5 Changed 15 years ago by Jean-Paul Calderone

Resolution: fixed
Status: newclosed

(In [20527]) Merge imap4-mixed-capabilities-2695

Author: exarkun Reviewer: therve Fixes #2695

Add support to IMAP4Client for handling CAPABILITY responses which include atoms of the form "FOO" and "FOO=BAR" (in either order).

Note: See TracTickets for help on using tickets.