# HG changeset patch # User Timo Sirainen # Date 1243371209 14400 # Node ID eead0542095f7fcab23d7cbd35428fcd7c19ab35 # Parent 9a0aa39a3a1493cdffb4261e43edbb331b120ddf message header parser: Don't set hdr->continues=TRUE when hdr->eoh=TRUE. This happened if body began with LWSP. Also if parser has seen eoh but not the following character, don't bother waiting for it. diff -r 9a0aa39a3a14 -r eead0542095f src/lib-mail/message-header-parser.c --- a/src/lib-mail/message-header-parser.c Tue May 26 14:21:59 2009 -0400 +++ b/src/lib-mail/message-header-parser.c Tue May 26 16:53:29 2009 -0400 @@ -106,14 +106,10 @@ /* error / EOF with no bytes */ return -1; } - if (ret == 0 && !ctx->input->eof) { - /* stream is nonblocking - need more data */ - return 0; - } - i_assert(size > 0); - if (msg[0] == '\n' || - (msg[0] == '\r' && size > 1 && msg[1] == '\n')) { + if (size > 0 && + (msg[0] == '\n' || + (msg[0] == '\r' && size > 1 && msg[1] == '\n'))) { /* end of headers - this mostly happens just with mbox where headers are read separately from body */ @@ -130,6 +126,11 @@ } break; } + if (ret == 0 && !ctx->input->eof) { + /* stream is nonblocking - need more data */ + return 0; + } + i_assert(size > 0); /* a) line is larger than input buffer b) header ended unexpectedly */ @@ -256,6 +257,8 @@ line->name_len = line->value_len = line->full_value_len = 0; line->name = ""; line->value = line->full_value = NULL; line->middle = NULL; line->middle_len = 0; + line->full_value_offset = line->name_offset; + line->continues = FALSE; } else if (line->continued) { line->value = msg; line->value_len = size;