Mercurial > dovecot > core-2.2
changeset 1771:63254344ea0e HEAD
get_header() returned only first line of multiline headers
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Wed, 10 Sep 2003 05:16:30 +0300 |
parents | ba17c15b9b40 |
children | c5fa45f0ebf6 |
files | src/lib-storage/index/index-mail-headers.c |
diffstat | 1 files changed, 14 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-storage/index/index-mail-headers.c Wed Sep 10 05:07:05 2003 +0300 +++ b/src/lib-storage/index/index-mail-headers.c Wed Sep 10 05:16:30 2003 +0300 @@ -573,6 +573,7 @@ { struct index_mail *mail = (struct index_mail *) _mail; struct cached_header *hdr; + const unsigned char *start, *end, *p; const char *arr[2]; int idx; @@ -600,8 +601,19 @@ } } - return hdr->value_idx == 0 ? NULL : - t_strcut(str_c(mail->data.header_data) + hdr->value_idx, '\n'); + if (hdr->value_idx == 0) + return NULL; + + start = str_data(mail->data.header_data); + end = start + str_len(mail->data.header_data); + for (p = start + hdr->value_idx; p != end; p++) { + if (*p == '\n') { + if (p+1 == end || (p[1] != ' ' && p[1] != '\t')) + break; + } + } + + return t_strdup_until(start, p); } struct istream *index_mail_get_headers(struct mail *_mail,