[dovecot-cvs] dovecot/src/lib-mail message-parser.c,1.51,1.52

cras at procontrol.fi cras at procontrol.fi
Sun May 9 20:05:20 EEST 2004


Update of /home/cvs/dovecot/src/lib-mail
In directory talvi:/tmp/cvs-serv27445/lib-mail

Modified Files:
	message-parser.c 
Log Message:
If value of header contains only LWSP, return all LWSP instead of returning
just empty value.



Index: message-parser.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-mail/message-parser.c,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -d -r1.51 -r1.52
--- message-parser.c	27 Apr 2004 20:25:53 -0000	1.51
+++ message-parser.c	9 May 2004 17:05:18 -0000	1.52
@@ -842,15 +842,27 @@
 		line->name_len = str_len(ctx->name);
 	} else {
 		/* get value. skip all LWSP after ':'. Note that RFC2822
-		   doesn't say we should, but history behind it.. */
+		   doesn't say we should, but history behind it..
+
+		   Exception to this is if the value consists only of LWSP,
+		   then skip only the one LWSP after ':'. */
 		line->value = msg + colon_pos+1;
 		line->value_len = size - colon_pos - 1;
-		while (line->value_len > 0 &&
-		       IS_LWSP(line->value[0])) {
+		while (line->value_len > 0 && IS_LWSP(line->value[0])) {
 			line->value++;
 			line->value_len--;
 		}
 
+		if (line->value_len == 0) {
+			/* everything was LWSP */
+			line->value = msg + colon_pos+1;
+			line->value_len = size - colon_pos - 1;
+			if (line->value_len > 0 && IS_LWSP(line->value[0])) {
+				line->value++;
+				line->value_len--;
+			}
+		}
+
 		/* get name, skip LWSP before ':' */
 		while (colon_pos > 0 && IS_LWSP(msg[colon_pos-1]))
 			colon_pos--;



More information about the dovecot-cvs mailing list