changeset 3539:7a94871543f5 HEAD

If mail_get_stream() is called when stream had already been used and seeked to non-start, it calculated the header/body sizes wrong.
author Timo Sirainen <tss@iki.fi>
date Mon, 15 Aug 2005 13:56:48 +0300
parents 261d98a81d74
children 0ddbfc6aa2d7
files src/lib-storage/index/index-mail.c
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-storage/index/index-mail.c	Mon Aug 15 12:03:08 2005 +0300
+++ b/src/lib-storage/index/index-mail.c	Mon Aug 15 13:56:48 2005 +0300
@@ -450,7 +450,8 @@
 	if (hdr_size != NULL || body_size != NULL)
 		(void)get_cached_msgpart_sizes(mail);
 
-	if (hdr_size != NULL) {
+	if (hdr_size != NULL || body_size != NULL) {
+		i_stream_seek(data->stream, 0);
 		if (!data->hdr_size_set) {
 			if ((data->access_part & PARSE_HDR) != 0) {
 				if (index_mail_parse_headers(mail, NULL) < 0)
@@ -466,6 +467,7 @@
 	}
 
 	if (body_size != NULL) {
+		i_stream_seek(data->stream, data->hdr_size.physical_size);
 		if (!data->body_size_set) {
 			if ((data->access_part & PARSE_BODY) != 0)
 				index_mail_parse_body(mail, FALSE);