summaryrefslogtreecommitdiffstats
path: root/imap/message.c
diff options
context:
space:
mode:
authorBrendan Cully <brendan@kublai.com>2007-04-12 09:16:06 -0700
committerBrendan Cully <brendan@kublai.com>2007-04-12 09:16:06 -0700
commite6a0dfe1395c4d8813b48dd025a621cf4df79414 (patch)
tree60ecc39dd590cb701ed3692903808ae47f910c14 /imap/message.c
parentb481405074e20b4b5d237471dd2254142dfb2bda (diff)
Handle a missing or corrupted header cache entry (closes #2676)
If imap_hcache_get fails, stop parsing the header cache and simply refetch from that point on.
Diffstat (limited to 'imap/message.c')
-rw-r--r--imap/message.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/imap/message.c b/imap/message.c
index 10ebd0fb..a7e2df14 100644
--- a/imap/message.c
+++ b/imap/message.c
@@ -161,6 +161,10 @@ int imap_read_headers (IMAP_DATA* idata, int msgbegin, int msgend)
break;
}
+ /* hole in the header cache */
+ if (!evalhc)
+ continue;
+
if ((mfhrc = msg_fetch_header (ctx, &h, idata->buf, NULL)) == -1)
continue;
else if (mfhrc < 0)
@@ -190,9 +194,12 @@ int imap_read_headers (IMAP_DATA* idata, int msgbegin, int msgend)
ctx->size += ctx->hdrs[idx]->content->length;
}
else
- /* bad header in the cache, we'll have to refetch.
- * TODO: consider the possibility of a holey cache. */
+ {
+ /* bad header in the cache, we'll have to refetch. */
+ dprint (3, (debugfile, "bad cache entry at %d, giving up\n", h.sid - 1));
imap_free_header_data((void**) (void*) &h.data);
+ evalhc = 0;
+ }
}
while (rc != IMAP_CMD_OK && mfhrc == -1);
if (rc == IMAP_CMD_OK)