Mercurial > dovecot > original-hg > dovecot-1.2
changeset 7253:6f9786d83007 HEAD
If stream ends unexpectedly, it was most likely because of a broken cached
field, so mark the cache corrupted.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Sat, 16 Feb 2008 15:44:51 +0200 |
parents | c96bf18c886b |
children | a9ddd7d0e160 |
files | src/imap/imap-fetch-body.c src/imap/imap-fetch.h |
diffstat | 2 files changed, 11 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/imap/imap-fetch-body.c Sat Feb 16 15:43:51 2008 +0200 +++ b/src/imap/imap-fetch-body.c Sat Feb 16 15:44:51 2008 +0200 @@ -200,6 +200,7 @@ "%"PRIuUOFF_T" vs %"PRIuUOFF_T, mailbox_get_name(ctx->mail->box), ctx->mail->uid, (uoff_t)sent, virtual_size); + mail_set_cache_corrupted(ctx->mail, ctx->cur_size_field); o_stream_close(output); return -1; } @@ -344,15 +345,18 @@ case '\0': /* BODY[] - fetch everything */ fetch_size = &body_size; + ctx->cur_size_field = MAIL_FETCH_VIRTUAL_SIZE; break; case 'H': /* BODY[HEADER] - fetch only header */ fetch_size = &hdr_size; + ctx->cur_size_field = MAIL_FETCH_MESSAGE_PARTS; break; case 'T': /* BODY[TEXT] - skip header */ i_stream_skip(ctx->cur_input, hdr_size.physical_size); fetch_size = &body_size; + ctx->cur_size_field = MAIL_FETCH_VIRTUAL_SIZE; break; default: i_unreached(); @@ -414,6 +418,7 @@ ctx->cur_append_eoh = TRUE; } + ctx->cur_size_field = 0; return fetch_data(ctx, body, &msg_size); } @@ -458,6 +463,7 @@ size.virtual_size += 2; ctx->cur_append_eoh = TRUE; + ctx->cur_size_field = 0; return fetch_data(ctx, body, &size); } @@ -534,6 +540,7 @@ i_stream_ref(ctx->cur_input); ctx->update_partial = TRUE; + ctx->cur_size_field = MAIL_FETCH_MESSAGE_PARTS; if (*section == '\0') { /* fetch the whole section */ @@ -893,6 +900,7 @@ } ctx->cur_size = size.virtual_size; + ctx->cur_size_field = MAIL_FETCH_VIRTUAL_SIZE; return fetch_stream(ctx, &size); } @@ -917,6 +925,7 @@ return -1; ctx->cur_size = hdr_size.virtual_size; + ctx->cur_size_field = MAIL_FETCH_MESSAGE_PARTS; return fetch_stream(ctx, &hdr_size); } @@ -942,6 +951,7 @@ i_stream_seek(ctx->cur_input, hdr_size.physical_size); ctx->cur_size = body_size.virtual_size; + ctx->cur_size_field = MAIL_FETCH_VIRTUAL_SIZE; return fetch_stream(ctx, &body_size); }
--- a/src/imap/imap-fetch.h Sat Feb 16 15:43:51 2008 +0200 +++ b/src/imap/imap-fetch.h Sat Feb 16 15:44:51 2008 +0200 @@ -46,6 +46,7 @@ struct mail *cur_mail; unsigned int cur_handler; uoff_t cur_size, cur_offset; + enum mail_fetch_field cur_size_field; string_t *cur_str; struct istream *cur_input; bool skip_cr;