dovecot-2.2: imap: FETCH BODY.PEEK[HEADER.FIELDS (..)] didn't se...
dovecot at dovecot.org
dovecot at dovecot.org
Mon May 4 15:46:28 UTC 2015
details: http://hg.dovecot.org/dovecot-2.2/rev/8c49fb6d789b
changeset: 18513:8c49fb6d789b
user: Timo Sirainen <tss at iki.fi>
date: Mon May 04 18:44:29 2015 +0300
description:
imap: FETCH BODY.PEEK[HEADER.FIELDS (..)] didn't set wanted_headers optimization.
Primarily this fixes imapc's prefetching.
diffstat:
src/imap/imap-fetch-body.c | 1 +
src/lib-imap-storage/imap-msgpart.c | 12 ++++++++++++
src/lib-imap-storage/imap-msgpart.h | 4 ++++
3 files changed, 17 insertions(+), 0 deletions(-)
diffs (47 lines):
diff -r d350a23207c2 -r 8c49fb6d789b src/imap/imap-fetch-body.c
--- a/src/imap/imap-fetch-body.c Mon May 04 18:31:27 2015 +0300
+++ b/src/imap/imap-fetch-body.c Mon May 04 18:44:29 2015 +0300
@@ -346,6 +346,7 @@
}
ctx->fetch_ctx->fetch_data |=
imap_msgpart_get_fetch_data(body->msgpart);
+ imap_msgpart_get_wanted_headers(body->msgpart, &ctx->fetch_ctx->all_headers);
if (body_parse_partial(body, p, &error) < 0) {
ctx->error = p_strdup_printf(ctx->pool,
diff -r d350a23207c2 -r 8c49fb6d789b src/lib-imap-storage/imap-msgpart.c
--- a/src/lib-imap-storage/imap-msgpart.c Mon May 04 18:31:27 2015 +0300
+++ b/src/lib-imap-storage/imap-msgpart.c Mon May 04 18:44:29 2015 +0300
@@ -333,6 +333,18 @@
return msgpart->wanted_fields;
}
+void imap_msgpart_get_wanted_headers(struct imap_msgpart *msgpart,
+ ARRAY_TYPE(const_string) *headers)
+{
+ unsigned int i;
+
+ if (msgpart->fetch_type != FETCH_HEADER_FIELDS)
+ return;
+
+ for (i = 0; msgpart->headers[i] != NULL; i++)
+ array_append(headers, &msgpart->headers[i], 1);
+}
+
static int
imap_msgpart_get_partial_header(struct mail *mail, struct istream *mail_input,
const struct imap_msgpart *msgpart,
diff -r d350a23207c2 -r 8c49fb6d789b src/lib-imap-storage/imap-msgpart.h
--- a/src/lib-imap-storage/imap-msgpart.h Mon May 04 18:31:27 2015 +0300
+++ b/src/lib-imap-storage/imap-msgpart.h Mon May 04 18:44:29 2015 +0300
@@ -36,6 +36,10 @@
uoff_t imap_msgpart_get_partial_size(struct imap_msgpart *msgpart);
/* Return wanted_fields mask. */
enum mail_fetch_field imap_msgpart_get_fetch_data(struct imap_msgpart *msgpart);
+/* Append all the specifically requested headers to the headers array
+ (no deduplication is done) */
+void imap_msgpart_get_wanted_headers(struct imap_msgpart *msgpart,
+ ARRAY_TYPE(const_string) *headers);
/* Open message part refenced by IMAP section as istream. Returns 0 if
successful, -1 if storage error. Returned istream is initially referenced,
More information about the dovecot-cvs
mailing list