[evolution-data-server/gnome-3-10] IMAPX: Handle BODY[HEADER] in FETCH response.
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server/gnome-3-10] IMAPX: Handle BODY[HEADER] in FETCH response.
- Date: Thu, 9 Jan 2014 17:30:14 +0000 (UTC)
commit e6c76ac3ca3a9f514d739e32aa886ddf4cc718a6
Author: Lubomir Rintel <lkundrak v3 sk>
Date: Thu Jan 9 12:19:53 2014 -0500
IMAPX: Handle BODY[HEADER] in FETCH response.
A broken IMAP server (whatever they use at Masaryk University) was
seen having this conversation:
C: A001 UID FETCH 1:* (RFC822.SIZE RFC822.HEADER FLAGS)
S: * 1 FETCH (RFC822.SIZE 4220 BODY[HEADER] {523} ...)
...
This confuses Camel into thinking it was a request for a full message
and it in turn fails to update the folder summary and issues a warning
about not being able to locate an appropriate FETCH job.
This works around the issue by treating BODY[HEADER] as equivalent to
RFC822.HEADER in untagged FETCH responses.
(cherry picked from commit 7b0b0de99a2943838b08560f11d7fdf5dac7d422)
camel/camel-imapx-server.c | 16 ++++++++++++++++
1 files changed, 16 insertions(+), 0 deletions(-)
---
diff --git a/camel/camel-imapx-server.c b/camel/camel-imapx-server.c
index f600000..cbc8e6c 100644
--- a/camel/camel-imapx-server.c
+++ b/camel/camel-imapx-server.c
@@ -1716,6 +1716,7 @@ imapx_untagged_fetch (CamelIMAPXServer *is,
GError **error)
{
struct _fetch_info *finfo;
+ gboolean got_body_header;
g_return_val_if_fail (CAMEL_IS_IMAPX_SERVER (is), FALSE);
@@ -1725,6 +1726,21 @@ imapx_untagged_fetch (CamelIMAPXServer *is,
return FALSE;
}
+ /* Some IMAP servers respond with BODY[HEADER] when
+ * asked for RFC822.HEADER. Treat them equivalently. */
+ got_body_header =
+ ((finfo->got & FETCH_HEADER) == 0) &&
+ (finfo->header == NULL) &&
+ ((finfo->got & FETCH_BODY) != 0) &&
+ (g_strcmp0 (finfo->section, "HEADER") == 0);
+
+ if (got_body_header) {
+ finfo->got |= FETCH_HEADER;
+ finfo->got &= ~FETCH_BODY;
+ finfo->header = finfo->body;
+ finfo->body = NULL;
+ }
+
if ((finfo->got & (FETCH_BODY | FETCH_UID)) == (FETCH_BODY | FETCH_UID)) {
CamelIMAPXJob *job;
GetMessageData *data;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]