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

cras at dovecot.org cras at dovecot.org
Sat Jun 17 20:10:43 EEST 2006


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

Modified Files:
	message-header-parser.c message-header-parser.h 
Log Message:
Added crlf_newline flag to header parser, which is set if the header ended   
with CR+LF instead of LF.



Index: message-header-parser.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-mail/message-header-parser.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- message-header-parser.c	8 May 2006 08:46:19 -0000	1.1
+++ message-header-parser.c	17 Jun 2006 17:10:38 -0000	1.2
@@ -74,6 +74,7 @@
 
 	last_no_newline = line->no_newline;
 	line->no_newline = FALSE;
+	line->crlf_newline = FALSE;
 
 	if (line->continues) {
 		if (line->use_full_value && !line->continued) {
@@ -133,9 +134,10 @@
 				size = 0;
 				if (ctx->hdr_size != NULL)
 					ctx->hdr_size->lines++;
-				if (msg[0] == '\r')
+				if (msg[0] == '\r') {
 					ctx->skip = 2;
-				else {
+					line->crlf_newline = TRUE;
+				} else {
 					ctx->skip = 1;
 					if (ctx->hdr_size != NULL)
 						ctx->hdr_size->virtual_size++;
@@ -218,10 +220,14 @@
 				if (ctx->hdr_size != NULL) {
 					ctx->hdr_size->physical_size += i;
 					ctx->hdr_size->virtual_size += i;
-					if (i == 0 || msg[i-1] != '\r') {
-						/* missing CR */
+				}
+
+				if (i == 0 || msg[i-1] != '\r') {
+					/* missing CR */
+					if (ctx->hdr_size != NULL)
 						ctx->hdr_size->virtual_size++;
-					}
+				} else {
+					line->crlf_newline = TRUE;
 				}
 				i_stream_skip(ctx->input, i);
 				startpos = 0;
@@ -239,6 +245,7 @@
 				size = i;
 			} else {
 				size = i-1;
+				line->crlf_newline = TRUE;
 			}
 
 			ctx->skip = i+1;

Index: message-header-parser.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-mail/message-header-parser.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- message-header-parser.h	8 May 2006 08:46:19 -0000	1.1
+++ message-header-parser.h	17 Jun 2006 17:10:38 -0000	1.2
@@ -26,6 +26,7 @@
 	unsigned int continued:1; /* multiline header, continues */
 	unsigned int eoh:1; /* "end of headers" line */
 	unsigned int no_newline:1; /* no \n after this line */
+	unsigned int crlf_newline:1; /* newline was \r\n */
 	unsigned int use_full_value:1; /* set if you want full_value */
 };
 



More information about the dovecot-cvs mailing list