dovecot: If we're at EOF but we wanted more data, return what we...
dovecot at dovecot.org
dovecot at dovecot.org
Thu Nov 8 03:40:59 EET 2007
details: http://hg.dovecot.org/dovecot/rev/f323da4ef459
changeset: 6729:f323da4ef459
user: Timo Sirainen <tss at iki.fi>
date: Thu Nov 08 03:40:55 2007 +0200
description:
If we're at EOF but we wanted more data, return what we have so far instead
of ignoring it.
diffstat:
1 file changed, 6 insertions(+), 4 deletions(-)
src/lib-mail/message-parser.c | 10 ++++++----
diffs (34 lines):
diff -r 79110f203734 -r f323da4ef459 src/lib-mail/message-parser.c
--- a/src/lib-mail/message-parser.c Thu Nov 08 03:21:48 2007 +0200
+++ b/src/lib-mail/message-parser.c Thu Nov 08 03:40:55 2007 +0200
@@ -114,6 +114,10 @@ static int message_parser_read_more(stru
ret = i_stream_read_data(ctx->input, &block_r->data,
&block_r->size, ctx->want_count);
if (ret <= 0) {
+ if (ret == -1 && block_r->size != 0) {
+ /* EOF, but we still have some data. return it. */
+ return 1;
+ }
if (ret < 0)
return ret;
@@ -303,8 +307,7 @@ static int parse_next_body_to_boundary(s
int ret;
bool eof, full;
- if ((ret = message_parser_read_more(ctx, block_r)) == 0 ||
- block_r->size == 0)
+ if ((ret = message_parser_read_more(ctx, block_r)) <= 0)
return ret;
eof = ret == -1;
full = ret == -2;
@@ -589,8 +592,7 @@ static int preparsed_parse_body_more(str
ctx->part->body_size.physical_size;
int ret;
- ret = message_parser_read_more(ctx, block_r);
- if (ret <= 0)
+ if ((ret = message_parser_read_more(ctx, block_r)) <= 0)
return ret;
if (ctx->input->v_offset + block_r->size >= end_offset) {
More information about the dovecot-cvs
mailing list