Mercurial > dovecot > core-2.2
changeset 2357:52eef63bebfd HEAD
Fixed a crash with fetch (rfc822.size body). Also fixed it so it doesn't
anymore parse the message body twice.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Fri, 23 Jul 2004 21:36:10 +0300 |
parents | d921b930abd7 |
children | 3df5796793bd |
files | src/lib-storage/index/index-mail.c src/lib-storage/index/index-mail.h |
diffstat | 2 files changed, 24 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-storage/index/index-mail.c Fri Jul 23 21:07:14 2004 +0300 +++ b/src/lib-storage/index/index-mail.c Fri Jul 23 21:36:10 2004 +0300 @@ -307,6 +307,8 @@ message_parser_parse_body(data->parser_ctx, parse_bodystructure_part_header, NULL, mail->pool); + data->save_bodystructure_body = FALSE; + data->parsed_bodystructure = TRUE; } else { message_parser_parse_body(data->parser_ctx, NULL, NULL, NULL); } @@ -406,21 +408,28 @@ string_t *str; int bodystructure_cached = FALSE; - if (data->save_bodystructure_header || !data->save_bodystructure_body) { - /* we haven't parsed the header yet */ - data->save_bodystructure_header = TRUE; - data->save_bodystructure_body = TRUE; - if (!index_mail_parse_headers(mail, NULL)) - return; - } + if (!data->parsed_bodystructure) { + if (data->save_bodystructure_header || + !data->save_bodystructure_body) { + /* we haven't parsed the header yet */ + data->save_bodystructure_header = TRUE; + data->save_bodystructure_body = TRUE; + if (!index_mail_parse_headers(mail, NULL)) + return; + } - if (data->parts != NULL) { - i_assert(data->parts->next == NULL); - message_parse_from_parts(data->parts->children, data->stream, - parse_bodystructure_part_header, - mail->pool); - } else { - index_mail_parse_body(mail, FALSE); + if (data->parts != NULL) { + i_assert(data->parts->next == NULL); + i_stream_seek(data->stream, + data->hdr_size.physical_size); + message_parse_from_parts(data->parts->children, + data->stream, + parse_bodystructure_part_header, + mail->pool); + data->parsed_bodystructure = TRUE; + } else { + index_mail_parse_body(mail, FALSE); + } } dec = mail_cache_field_get_decision(mail->ibox->cache,
--- a/src/lib-storage/index/index-mail.h Fri Jul 23 21:07:14 2004 +0300 +++ b/src/lib-storage/index/index-mail.h Fri Jul 23 21:36:10 2004 +0300 @@ -77,6 +77,7 @@ unsigned int save_sent_date:1; unsigned int save_bodystructure_header:1; unsigned int save_bodystructure_body:1; + unsigned int parsed_bodystructure:1; unsigned int hdr_size_set:1; unsigned int body_size_set:1; unsigned int open_mail:1;