[dovecot-cvs] dovecot/src/imap imap-fetch-body.c,1.15,1.16

cras at dovecot.org cras at dovecot.org
Sun Dec 19 02:46:12 EET 2004


Update of /var/lib/cvs/dovecot/src/imap
In directory talvi:/tmp/cvs-serv18522/imap

Modified Files:
	imap-fetch-body.c 
Log Message:
MIME part header fetches weren't working correctly.



Index: imap-fetch-body.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/imap/imap-fetch-body.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- imap-fetch-body.c	20 Oct 2004 18:09:32 -0000	1.15
+++ imap-fetch-body.c	19 Dec 2004 00:46:10 -0000	1.16
@@ -366,6 +366,7 @@
 {
 	struct message_size msg_size;
 	struct istream *input;
+	uoff_t old_offset;
 
 	/* MIME, HEADER.FIELDS (list), HEADER.FIELDS.NOT (list) */
 
@@ -398,8 +399,9 @@
 	ctx->cur_input = input;
 	ctx->update_partial = FALSE;
 
+	old_offset = ctx->cur_input->v_offset;
 	message_get_header_size(ctx->cur_input, &msg_size, NULL);
-	i_stream_seek(ctx->cur_input, 0);
+	i_stream_seek(ctx->cur_input, old_offset);
 
 	if (!ctx->cur_have_eoh &&
 	    (client_workarounds & WORKAROUND_NETSCAPE_EOH) != 0) {
@@ -432,6 +434,7 @@
 {
 	const struct imap_fetch_body_data *body = context;
 	struct message_size size;
+	uoff_t old_offset;
 
 	ctx->cur_input = mail->get_headers(mail, body->header_ctx);
 	if (ctx->cur_input == NULL)
@@ -440,8 +443,9 @@
 	i_stream_ref(ctx->cur_input);
 	ctx->update_partial = FALSE;
 
+	old_offset = ctx->cur_input->v_offset;
 	message_get_body_size(ctx->cur_input, &size, NULL);
-	i_stream_seek(ctx->cur_input, 0);
+	i_stream_seek(ctx->cur_input, old_offset);
 
 	/* FIXME: We'll just always add the end of headers line now.
 	   ideally mail-storage would have a way to tell us if it exists. */
@@ -537,6 +541,7 @@
 
 	if (strcmp(section, "HEADER") == 0) {
 		/* all headers */
+		i_stream_seek(ctx->cur_input, part->physical_pos);
 		return fetch_data(ctx, body, &part->header_size);
 	}
 



More information about the dovecot-cvs mailing list