[PATCH] lib-imap: imap-bodystructure: add test with empty header field

Simon Ser contact at emersion.fr
Tue Mar 3 20:38:03 EET 2020


This causes the body structure to be incorrect. The RFC says it's fine o
have empty header field values.
---

This just adds a failing test, inspired from an e-mail spotted in the
wild. Ideas welcome to fix it.

 src/lib-imap/test-imap-bodystructure.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/src/lib-imap/test-imap-bodystructure.c b/src/lib-imap/test-imap-bodystructure.c
index 6f456a44530b..b8f215d689c4 100644
--- a/src/lib-imap/test-imap-bodystructure.c
+++ b/src/lib-imap/test-imap-bodystructure.c
@@ -41,6 +41,19 @@ struct parse_test parse_tests[] = {
 			"\"text\" \"plain\" (\"charset\" \"utf-8\") NIL NIL \"8bit\" 8 2 NIL NIL NIL NIL",
 		.body =
 			"\"text\" \"plain\" (\"charset\" \"utf-8\") NIL NIL \"8bit\" 8 2"
+	},{
+		.message =
+			"From: user at domain.org\n"
+			"Date: Sat, 24 Mar 2017 23:00:00 +0200\n"
+			"X-Spam-Level:\n"
+			"Content-Transfer-Encoding: quoted-printable\n"
+			"\n"
+			"body\n"
+			"\n",
+		.bodystructure =
+			"\"text\" \"plain\" (\"charset\" \"us-ascii\") NIL NIL \"quoted-printable\" 8 2 NIL NIL NIL NIL",
+		.body =
+			"\"text\" \"plain\" (\"charset\" \"us-ascii\") NIL NIL \"quoted-printable\" 8 2"
 	},{
 		.message =
 			"From: user at domain.org\n"
--
2.25.1




More information about the dovecot mailing list