]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
If value of header contains only LWSP, return all LWSP instead of returning
authorTimo Sirainen <tss@iki.fi>
Sun, 9 May 2004 17:05:18 +0000 (20:05 +0300)
committerTimo Sirainen <tss@iki.fi>
Sun, 9 May 2004 17:05:18 +0000 (20:05 +0300)
just empty value.

--HG--
branch : HEAD

src/lib-mail/message-parser.c

index 67acf0f51f0b25a306c46ab1aa555091c72365f0..9ea0d1273b9d07d1d9f5400135f66a6a45163d45 100644 (file)
@@ -842,15 +842,27 @@ message_parse_header_next(struct message_header_parser_ctx *ctx)
                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--;