Mercurial > dovecot > original-hg > dovecot-1.2
changeset 4409:6744d3eb4113 HEAD
Added crlf_newline flag to header parser, which is set if the header ended
with CR+LF instead of LF.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Sat, 17 Jun 2006 20:10:38 +0300 |
parents | 9c9dec4901d9 |
children | 46710be9f4bf |
files | src/lib-mail/message-header-parser.c src/lib-mail/message-header-parser.h |
diffstat | 2 files changed, 13 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-mail/message-header-parser.c Sat Jun 17 19:50:00 2006 +0300 +++ b/src/lib-mail/message-header-parser.c Sat Jun 17 20:10:38 2006 +0300 @@ -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;
--- a/src/lib-mail/message-header-parser.h Sat Jun 17 19:50:00 2006 +0300 +++ b/src/lib-mail/message-header-parser.h Sat Jun 17 20:10:38 2006 +0300 @@ -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 */ };