Mercurial > dovecot > original-hg > dovecot-1.2
changeset 2404:8ef002a26f1c HEAD
Added struct message_header_line.middle and middle_len to contain the ':'
in header and whitespace around it.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Sat, 31 Jul 2004 03:33:53 +0300 |
parents | 3af28e102a39 |
children | 4f827b29c9b8 |
files | src/imap/imap-fetch-body-section.c src/lib-mail/istream-header-filter.c src/lib-mail/message-parser.c src/lib-mail/message-parser.h src/lib-storage/index/index-mail-headers.c src/lib-storage/index/mbox/mbox-sync-parse.c src/lib-storage/index/mbox/mbox-sync-private.h src/lib-storage/index/mbox/mbox-sync-rewrite.c src/lib-storage/mail-save.c |
diffstat | 9 files changed, 21 insertions(+), 21 deletions(-) [+] |
line wrap: on
line diff
--- a/src/imap/imap-fetch-body-section.c Sat Jul 31 02:37:14 2004 +0300 +++ b/src/imap/imap-fetch-body-section.c Sat Jul 31 03:33:53 2004 +0300 @@ -302,7 +302,8 @@ if (!hdr->continued) { if (!fetch_header_append(ctx, hdr->name, hdr->name_len)) break; - if (!fetch_header_append(ctx, ": ", 2)) + if (!fetch_header_append(ctx, hdr->middle, + hdr->middle_len)) break; } if (!fetch_header_append(ctx, hdr->value, hdr->value_len))
--- a/src/lib-mail/istream-header-filter.c Sat Jul 31 02:37:14 2004 +0300 +++ b/src/lib-mail/istream-header-filter.c Sat Jul 31 03:33:53 2004 +0300 @@ -143,7 +143,8 @@ } else if (dest != NULL) { if (!hdr->continued) { buffer_append(dest, hdr->name, hdr->name_len); - buffer_append(dest, ": ", 2); + buffer_append(dest, hdr->middle, + hdr->middle_len); } buffer_append(dest, hdr->value, hdr->value_len); buffer_append(dest, "\r\n", 2);
--- a/src/lib-mail/message-parser.c Sat Jul 31 02:37:14 2004 +0300 +++ b/src/lib-mail/message-parser.c Sat Jul 31 03:33:53 2004 +0300 @@ -832,9 +832,12 @@ line->eoh = TRUE; line->name_len = line->value_len = line->full_value_len = 0; line->name = ""; line->value = line->full_value = NULL; + line->middle = NULL; line->middle_len = 0; } else if (line->continued) { line->value = msg; line->value_len = size; + line->middle = NULL; + line->middle_len = 0; } else if (colon_pos == UINT_MAX) { /* missing ':', assume the whole line is name */ line->value = NULL; @@ -844,6 +847,9 @@ str_append_n(ctx->name, msg, size); line->name = str_c(ctx->name); line->name_len = str_len(ctx->name); + + line->middle = NULL; + line->middle_len = 0; } else { size_t pos; @@ -880,6 +886,9 @@ while (colon_pos > 0 && IS_LWSP(msg[colon_pos-1])) colon_pos--; + line->middle = msg + colon_pos; + line->middle_len = (size_t)(line->value - line->middle); + str_truncate(ctx->name, 0); str_append_n(ctx->name, msg, colon_pos); line->name = str_c(ctx->name);
--- a/src/lib-mail/message-parser.h Sat Jul 31 02:37:14 2004 +0300 +++ b/src/lib-mail/message-parser.h Sat Jul 31 03:33:53 2004 +0300 @@ -50,6 +50,9 @@ const unsigned char *full_value; size_t full_value_len; + const unsigned char *middle; + size_t middle_len; + uoff_t name_offset, full_value_offset; unsigned int continues:1; /* multiline header, continues in next line */
--- a/src/lib-storage/index/index-mail-headers.c Sat Jul 31 02:37:14 2004 +0300 +++ b/src/lib-storage/index/index-mail-headers.c Sat Jul 31 03:33:53 2004 +0300 @@ -285,7 +285,7 @@ data->parse_line.start_pos = str_len(mail->header_data); data->parse_line.line_num = data->parse_line_num; str_append(mail->header_data, hdr->name); - str_append(mail->header_data, ": "); + str_append_n(mail->header_data, hdr->middle, hdr->middle_len); if (first_hdr) { /* save the offset to first header */
--- a/src/lib-storage/index/mbox/mbox-sync-parse.c Sat Jul 31 02:37:14 2004 +0300 +++ b/src/lib-storage/index/mbox/mbox-sync-parse.c Sat Jul 31 03:33:53 2004 +0300 @@ -388,21 +388,7 @@ if (!hdr->continued) { line_start_pos = str_len(ctx->header); str_append(ctx->header, hdr->name); - str_append(ctx->header, ": "); - - if (ctx->header_first_change == (size_t)-1 && - hdr->full_value_offset - hdr->name_offset != - str_len(ctx->header) - line_start_pos) { - /* whitespaces around ':' are non-standard. - either there's whitespace before ':' or none - after. if we're going to rewrite this - message, we can't do it partially from here - after as offsets won't match. this shouldn't - happen pretty much ever, so don't try to - optimize this - just rewrite the whole - thing. */ - ctx->no_partial_rewrite = TRUE; - } + str_append_n(ctx->header, hdr->middle, hdr->middle_len); } func = header_func_find(hdr->name);
--- a/src/lib-storage/index/mbox/mbox-sync-private.h Sat Jul 31 02:37:14 2004 +0300 +++ b/src/lib-storage/index/mbox/mbox-sync-private.h Sat Jul 31 03:33:53 2004 +0300 @@ -69,7 +69,6 @@ unsigned int have_eoh:1; unsigned int need_rewrite:1; - unsigned int no_partial_rewrite:1; unsigned int seen_imapbase:1; unsigned int pseudo:1; unsigned int updated:1;
--- a/src/lib-storage/index/mbox/mbox-sync-rewrite.c Sat Jul 31 02:37:14 2004 +0300 +++ b/src/lib-storage/index/mbox/mbox-sync-rewrite.c Sat Jul 31 03:33:53 2004 +0300 @@ -267,7 +267,7 @@ return 1; } - if (move_diff != 0 || ctx->no_partial_rewrite) { + if (move_diff != 0) { /* forget about partial write optimizations */ ctx->header_first_change = 0; ctx->header_last_change = 0;
--- a/src/lib-storage/mail-save.c Sat Jul 31 02:37:14 2004 +0300 +++ b/src/lib-storage/mail-save.c Sat Jul 31 03:33:53 2004 +0300 @@ -109,7 +109,8 @@ if (!hdr->continued) { (void)o_stream_send(output, hdr->name, hdr->name_len); - (void)o_stream_send(output, ": ", 2); + (void)o_stream_send(output, hdr->middle, + hdr->middle_len); } (void)o_stream_send(output, hdr->value, hdr->value_len); if (!hdr->no_newline)