dovecot-1.2: imap: Improve "FETCH .. got too little data" error ...
dovecot at dovecot.org
dovecot at dovecot.org
Wed Mar 11 22:04:08 EET 2009
details: http://hg.dovecot.org/dovecot-1.2/rev/69a5c4798421
changeset: 8812:69a5c4798421
user: Timo Sirainen <tss at iki.fi>
date: Wed Mar 11 16:04:01 2009 -0400
description:
imap: Improve "FETCH .. got too little data" error messages.
diffstat:
2 files changed, 11 insertions(+), 5 deletions(-)
src/imap/imap-fetch-body.c | 15 ++++++++++-----
src/imap/imap-fetch.h | 1 +
diffs (72 lines):
diff -r 69ddd7c9c585 -r 69a5c4798421 src/imap/imap-fetch-body.c
--- a/src/imap/imap-fetch-body.c Tue Mar 10 12:28:22 2009 -0400
+++ b/src/imap/imap-fetch-body.c Wed Mar 11 16:04:01 2009 -0400
@@ -207,8 +207,8 @@ static off_t imap_fetch_send(struct imap
and if it was just a temporary error the message would be
permanently left corrupted in client's local cache. So, we
disconnect the client and hope that next try works. */
- i_error("FETCH for mailbox %s UID %u got too little data: "
- "%"PRIuUOFF_T" vs %"PRIuUOFF_T,
+ i_error("FETCH %s for mailbox %s UID %u got too little data: "
+ "%"PRIuUOFF_T" vs %"PRIuUOFF_T, ctx->cur_name,
mailbox_get_name(ctx->mail->box), ctx->mail->uid,
(uoff_t)sent, virtual_size);
mail_set_cache_corrupted(ctx->mail, ctx->cur_size_field);
@@ -269,10 +269,10 @@ static int fetch_stream_send_direct(stru
/* unfinished */
if (!i_stream_have_bytes_left(ctx->cur_input)) {
/* Input stream gave less data than expected */
- i_error("FETCH for mailbox %s UID %u "
- "got too little data: "
+ i_error("FETCH %s for mailbox %s UID %u "
+ "got too little data (copying): "
"%"PRIuUOFF_T" vs %"PRIuUOFF_T,
- mailbox_get_name(ctx->mail->box),
+ ctx->cur_name, mailbox_get_name(ctx->mail->box),
ctx->mail->uid, ctx->cur_offset, ctx->cur_size);
o_stream_close(ctx->client->output);
return -1;
@@ -310,6 +310,8 @@ static int fetch_data(struct imap_fetch_
{
string_t *str;
+ ctx->cur_name = p_strconcat(ctx->cmd->pool,
+ "[", body->section, "]", NULL);
ctx->cur_size = get_send_size(body, size->virtual_size);
str = get_prefix(ctx, body, ctx->cur_size);
@@ -922,6 +924,7 @@ static int fetch_rfc822(struct imap_fetc
return -1;
}
+ ctx->cur_name = "RFC822";
ctx->cur_size = size.virtual_size;
ctx->cur_size_field = MAIL_FETCH_VIRTUAL_SIZE;
return fetch_stream(ctx, &size);
@@ -947,6 +950,7 @@ static int fetch_rfc822_header(struct im
if (o_stream_send_str(ctx->client->output, str) < 0)
return -1;
+ ctx->cur_name = "RFC822.HEADER";
ctx->cur_size = hdr_size.virtual_size;
ctx->cur_size_field = MAIL_FETCH_MESSAGE_PARTS;
return fetch_stream(ctx, &hdr_size);
@@ -973,6 +977,7 @@ static int fetch_rfc822_text(struct imap
return -1;
i_stream_seek(ctx->cur_input, hdr_size.physical_size);
+ ctx->cur_name = "RFC822.TEXT";
ctx->cur_size = body_size.virtual_size;
ctx->cur_size_field = MAIL_FETCH_VIRTUAL_SIZE;
return fetch_stream(ctx, &body_size);
diff -r 69ddd7c9c585 -r 69a5c4798421 src/imap/imap-fetch.h
--- a/src/imap/imap-fetch.h Tue Mar 10 12:28:22 2009 -0400
+++ b/src/imap/imap-fetch.h Wed Mar 11 16:04:01 2009 -0400
@@ -46,6 +46,7 @@ struct imap_fetch_context {
struct mail *cur_mail;
unsigned int cur_handler;
+ const char *cur_name;
uoff_t cur_size, cur_offset;
enum mail_fetch_field cur_size_field;
string_t *cur_str;
More information about the dovecot-cvs
mailing list