]> granicus.if.org Git - mutt/commitdiff
Handle a missing or corrupted header cache entry (closes #2676)
authorBrendan Cully <brendan@kublai.com>
Thu, 12 Apr 2007 16:16:06 +0000 (09:16 -0700)
committerBrendan Cully <brendan@kublai.com>
Thu, 12 Apr 2007 16:16:06 +0000 (09:16 -0700)
If imap_hcache_get fails, stop parsing the header cache and simply
refetch from that point on.

imap/message.c

index 10ebd0fbc3e87b6e0128707364172d56bc02c434..a7e2df1480d15d5aafaf8b6fb1bbffb120579b68 100644 (file)
@@ -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)