dovecot-1.1: If stream ends unexpectedly, it was most likely bec...
dovecot at dovecot.org
dovecot at dovecot.org
Sat Feb 16 15:44:22 EET 2008
details: http://hg.dovecot.org/dovecot-1.1/rev/6f9786d83007
changeset: 7253:6f9786d83007
user: Timo Sirainen <tss at iki.fi>
date: Sat Feb 16 15:44:51 2008 +0200
description:
If stream ends unexpectedly, it was most likely because of a broken cached
field, so mark the cache corrupted.
diffstat:
2 files changed, 11 insertions(+)
src/imap/imap-fetch-body.c | 10 ++++++++++
src/imap/imap-fetch.h | 1 +
diffs (89 lines):
diff -r c96bf18c886b -r 6f9786d83007 src/imap/imap-fetch-body.c
--- 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 @@ static off_t imap_fetch_send(struct imap
"%"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 @@ static int fetch_body(struct imap_fetch_
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 @@ static int fetch_header_partial_from(str
ctx->cur_append_eoh = TRUE;
}
+ ctx->cur_size_field = 0;
return fetch_data(ctx, body, &msg_size);
}
@@ -458,6 +463,7 @@ fetch_body_header_fields(struct imap_fet
size.virtual_size += 2;
ctx->cur_append_eoh = TRUE;
+ ctx->cur_size_field = 0;
return fetch_data(ctx, body, &size);
}
@@ -534,6 +540,7 @@ static int fetch_body_mime(struct imap_f
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 @@ static int fetch_rfc822(struct imap_fetc
}
ctx->cur_size = size.virtual_size;
+ ctx->cur_size_field = MAIL_FETCH_VIRTUAL_SIZE;
return fetch_stream(ctx, &size);
}
@@ -917,6 +925,7 @@ static int fetch_rfc822_header(struct im
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 @@ static int fetch_rfc822_text(struct imap
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);
}
diff -r c96bf18c886b -r 6f9786d83007 src/imap/imap-fetch.h
--- 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 imap_fetch_context {
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;
More information about the dovecot-cvs
mailing list