]> Pileus Git - ~andy/fetchmail/commitdiff
Work around InterChange.
authorEric S. Raymond <esr@thyrsus.com>
Tue, 21 Mar 2000 11:40:55 +0000 (11:40 -0000)
committerEric S. Raymond <esr@thyrsus.com>
Tue, 21 Mar 2000 11:40:55 +0000 (11:40 -0000)
svn path=/trunk/; revision=2830

NEWS
fetchmailconf
imap.c

diff --git a/NEWS b/NEWS
index f796b73ea6e663760dad6dbc59445b20f002da34..fef03288663227bedcffbaa2c1bd3a55630625c8 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,8 @@
 * Added FAQ item on performance under load.
 * Fix Debian bug #60202 (segfaults when given command line arguments).
   This only applied to `antispam', as it turned out.
+* Work around InterChange's bug with attachments as suggested by 
+  paul666@mailandnews.com.
 
 fetchmail-5.3.3 (Mon Mar 13 16:34:29 EST 2000), 18763 lines:
 
index 639eb088d868fffe02e4a0921d001b6477f9120d..585f2235c977f6a5ea655ee38b84bd8ec48e3830 100755 (executable)
@@ -1259,9 +1259,12 @@ same messages will be downloaded over and over.
 """
             if string.find(greetline, "InterChange") > 0:
                 warnings = warnings + """
-The InterChange IMAP server screws up on mail with attachments.  It reports
-the message size with attachments included, but doesn't download them on a
-RETR or TOP (this violates the IMAP RFCs).  You should get rid of it. 
+The InterChange IMAP server screws up on mail with attachments.  It
+doesn't fetch them if you give it a BODY[TEXT] request, though it
+does if you request RFC822.TEXT (according to the IMAP RFCs and their
+maintainer these should be equivalent).  We have worked around this
+bug, but suspect InterChange is likely to be broken in other ways.
+You should get rid of it. 
 
 """
             if string.find(greetline, "Imail") > 0:
diff --git a/imap.c b/imap.c
index c9df435e2ddcadf323b9a5937c92491f0a43834d..fe8bffe7029f144180fef95a7fc2a77710fc91cd 100644 (file)
--- a/imap.c
+++ b/imap.c
@@ -1246,15 +1246,29 @@ static int imap_fetch_body(int sock, struct query *ctl, int number, int *lenp)
      * In that case, marking the seen flag is the only way to prevent the
      * message from being re-fetched on subsequent runs (and according
      * to RFC2060 p.43 this fetch should set Seen as a side effect).
+     *
+     * According to RFC2060, and Mark Crispin the IMAP maintainer,
+     * FETCH %d BODY[TEXT] and RFC822.TEXT are "functionally 
+     * equivalent".  However, we know of at least one server that
+     * treats them differently in the presence of MIME attachments;
+     * the latter form downloads the attachment, the former does not.
+     * The server is InterChange, and the fool who implemented this
+     * misfeature ought to be strung up by his thumbs.  
+     *
+     * To work around this, we disable use of the 4rev1 form.  It's
+     * all too easy to imagine other clever idiots deciding that the
+     * message body doesn't include attachments.
      */
     switch (imap_version)
     {
     case IMAP4rev1:    /* RFC 2060 */
+#ifdef __UNUSED__
        if (!ctl->keep)
            gen_send(sock, "FETCH %d BODY.PEEK[TEXT]", number);
        else
            gen_send(sock, "FETCH %d BODY[TEXT]", number);
        break;
+#endif /* UNUSED -- FALL THROGH */
 
     case IMAP4:                /* RFC 1730 */
        if (!ctl->keep)