From: Sunil S. <sh...@bo...> - 2005-12-16 17:59:21
|
Quoting from Jason White's mail on Fri, Dec 16, 2005: > I am quite confident this is a protocol issue, but I don't know IMAP and > Fetchmail well enough to debug it. For some reason, it appears that Fetchmail > doesn't detect the final "OK" message from the server and simply times out > after retrieving the headers. Using an MUA (e.g., muttng), I can successfully > retrieve messages via IMAP from this server. For the moment, I have configured > fetchmail to use pop3 instead as a work-around so I can read mail easily from > this account. Your IMAP server is also sending UID information in the response. It needs to be checked if sending UIDs in response is valid or not. > From syslog: ... > Dec 16 18:40:03 jdc fetchmail[13415]: IMAP> A0005 FETCH 1 RFC822.SIZE > Dec 16 18:40:03 jdc fetchmail[13415]: IMAP< * 1 FETCH (UID 16 RFC822.SIZE 1447) ^^^^^^ > Dec 16 18:40:03 jdc fetchmail[13415]: IMAP< A0005 OK FETCH completed > Dec 16 18:40:03 jdc fetchmail[13415]: IMAP> A0006 FETCH 1 RFC822.HEADER > Dec 16 18:40:03 jdc fetchmail[13415]: IMAP< * 1 FETCH (UID 16 RFC822.HEADER {1360} ^^^^^^ ... > Dec 16 18:40:03 jdc fetchmail[13415]: IMAP< A0006 OK FETCH completed fetchmail is not expecting UIDs in the response. Hence the protocol error. Could you try this patch and tell me if it works for you? Note that you may get more errors if UIDs are sent in further responses (like RFC822.TEXT) which have not been reached yet. Here's the patch: Index: fetchmail/imap.c =================================================================== --- fetchmail/imap.c (revision 4550) +++ fetchmail/imap.c (working copy) @@ -880,8 +880,18 @@ if (num >= first && num <= last) sizes[num - first] = size; else - report(stderr, "Warning: ignoring bogus data for message sizes returned by the server.\n"); + report(stderr, + GT_("Warning: ignoring bogus data for message sizes returned by the server.\n")); } + /* some servers return UID information here */ + else if (sscanf(buf, "* %u FETCH (UID %*s RFC822.SIZE %u)", &num, &size) == 2) + { + if (num >= first && num <= last) + sizes[num - first] = size; + else + report(stderr, + GT_("Warning: ignoring bogus data for message sizes returned by the server.\n")); + } } return(PS_SUCCESS); @@ -948,8 +958,11 @@ if ((ok = gen_recv(sock, buf, sizeof(buf)))) return(ok); ptr = skip_token(buf); /* either "* " or "AXXXX " */ - if (sscanf(ptr, "%d FETCH (%*s {%d}", &num, lenp) == 2) + if (sscanf(ptr, "%d FETCH (RFC822.HEADER {%d}", &num, lenp) == 2) break; + /* some servers return UID information here */ + else if (sscanf(ptr, "%d FETCH (UID %*s RFC822.HEADER {%d}", &num, lenp) == 2) + break; /* try to recover from chronically fucked-up M$ Exchange servers */ else if (!strncmp(ptr, "NO", 2)) { -- Sunil Shetye. |