[dovecot-cvs] dovecot/src/lib-mail message-header-parser.c, 1.2, 1.3

tss at dovecot.org tss at dovecot.org
Tue Oct 24 22:47:32 UTC 2006


Update of /var/lib/cvs/dovecot/src/lib-mail
In directory talvi:/tmp/cvs-serv3337

Modified Files:
	message-header-parser.c 
Log Message:
Remember hdr->middle for the header's whole lifetime.



Index: message-header-parser.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-mail/message-header-parser.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- message-header-parser.c	17 Jun 2006 17:10:38 -0000	1.2
+++ message-header-parser.c	24 Oct 2006 21:47:30 -0000	1.3
@@ -264,8 +264,6 @@
 	} 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;
@@ -314,13 +312,19 @@
 		while (colon_pos > 0 && IS_LWSP(msg[colon_pos-1]))
 			colon_pos--;
 
+		str_truncate(ctx->name, 0);
+		str_append_n(ctx->name, msg, colon_pos);
+		str_append_c(ctx->name, '\0');
+
+		/* keep middle stored also in ctx->name so it's available
+		   with use_full_value */
 		line->middle = msg + colon_pos;
 		line->middle_len = (size_t)(line->value - line->middle);
+		str_append_n(ctx->name, line->middle, line->middle_len);
 
-		str_truncate(ctx->name, 0);
-		str_append_n(ctx->name, msg, colon_pos);
 		line->name = str_c(ctx->name);
-		line->name_len = str_len(ctx->name);
+		line->name_len = colon_pos;
+		line->middle = str_data(ctx->name) + line->name_len + 1;
 	}
 
 	if (!line->continued) {



More information about the dovecot-cvs mailing list