test-imap-bodystructure.c revision bac296ef1a106abdc166ba3741246a3d480ba6f0
bcb4e51a409d94ae670de96afb8483a4f7855294Stephan Bosch/* Copyright (c) 2013-2017 Dovecot authors, see the included COPYING file */
3fcb3d2d1f3583025ff62bae95ec706920f398b1Stephan Bosch "From: user@domain.org\n"
3fcb3d2d1f3583025ff62bae95ec706920f398b1Stephan Bosch "Date: Sat, 24 Mar 2017 23:00:00 +0200\n"
3fcb3d2d1f3583025ff62bae95ec706920f398b1Stephan Bosch "Mime-Version: 1.0\n"
3fcb3d2d1f3583025ff62bae95ec706920f398b1Stephan Bosch "Content-Type: text/plain; charset=us-ascii\n"
3fcb3d2d1f3583025ff62bae95ec706920f398b1Stephan Bosch "\"text\" \"plain\" (\"charset\" \"us-ascii\") NIL NIL \"7bit\" 6 1 NIL NIL NIL NIL",
3fcb3d2d1f3583025ff62bae95ec706920f398b1Stephan Bosch "\"text\" \"plain\" (\"charset\" \"us-ascii\") NIL NIL \"7bit\" 6 1"
3fcb3d2d1f3583025ff62bae95ec706920f398b1Stephan Bosch "From: user@domain.org\n"
3fcb3d2d1f3583025ff62bae95ec706920f398b1Stephan Bosch "Date: Sat, 24 Mar 2017 23:00:00 +0200\n"
3fcb3d2d1f3583025ff62bae95ec706920f398b1Stephan Bosch "Mime-Version: 1.0\n"
3fcb3d2d1f3583025ff62bae95ec706920f398b1Stephan Bosch "Content-Type: text/plain; charset=utf-8\n"
3fcb3d2d1f3583025ff62bae95ec706920f398b1Stephan Bosch "Content-Transfer-Encoding: 8bit\n"
3fcb3d2d1f3583025ff62bae95ec706920f398b1Stephan Bosch "\"text\" \"plain\" (\"charset\" \"utf-8\") NIL NIL \"8bit\" 8 2 NIL NIL NIL NIL",
3fcb3d2d1f3583025ff62bae95ec706920f398b1Stephan Bosch "\"text\" \"plain\" (\"charset\" \"utf-8\") NIL NIL \"8bit\" 8 2"
3fcb3d2d1f3583025ff62bae95ec706920f398b1Stephan Bosch "From: user@domain.org\n"
3fcb3d2d1f3583025ff62bae95ec706920f398b1Stephan Bosch "Date: Sat, 24 Mar 2007 23:00:00 +0200\n"
3fcb3d2d1f3583025ff62bae95ec706920f398b1Stephan Bosch "Mime-Version: 1.0\n"
3fcb3d2d1f3583025ff62bae95ec706920f398b1Stephan Bosch "Content-Type: multipart/mixed; boundary=\"foo\n"
f9d2a1f21ad65262bc630f0834d7eead06a1bac3Timo Sirainen "--foo bar\n"
3fcb3d2d1f3583025ff62bae95ec706920f398b1Stephan Bosch "Content-Type: text/x-myown; charset=us-ascii\n"
3fcb3d2d1f3583025ff62bae95ec706920f398b1Stephan Bosch "--foo bar--\n"
3fcb3d2d1f3583025ff62bae95ec706920f398b1Stephan Bosch "(\"text\" \"x-myown\" (\"charset\" \"us-ascii\") NIL NIL \"7bit\" 7 1 NIL NIL NIL NIL) \"mixed\" (\"boundary\" \"foo bar\") NIL NIL NIL",
3fcb3d2d1f3583025ff62bae95ec706920f398b1Stephan Bosch "(\"text\" \"x-myown\" (\"charset\" \"us-ascii\") NIL NIL \"7bit\" 7 1) \"mixed\""
3fcb3d2d1f3583025ff62bae95ec706920f398b1Stephan Bosch "From: user@domain.org\n"
3fcb3d2d1f3583025ff62bae95ec706920f398b1Stephan Bosch "Date: Sat, 24 Mar 2017 23:00:00 +0200\n"
3fcb3d2d1f3583025ff62bae95ec706920f398b1Stephan Bosch "Mime-Version: 1.0\n"
3fcb3d2d1f3583025ff62bae95ec706920f398b1Stephan Bosch "Content-Type: multipart/mixed; boundary=\"foo bar\"\n"
3fcb3d2d1f3583025ff62bae95ec706920f398b1Stephan Bosch "--foo bar\n"
3fcb3d2d1f3583025ff62bae95ec706920f398b1Stephan Bosch "Content-Type: text/plain; charset=us-ascii\n"
3fcb3d2d1f3583025ff62bae95ec706920f398b1Stephan Bosch "See attached...\n"
e1a4ea6ad3e799ef8df7395e765c0ae9218e6c5dStephan Bosch "--foo bar\n"
e1a4ea6ad3e799ef8df7395e765c0ae9218e6c5dStephan Bosch "Content-Type: message/rfc822\n"
e1a4ea6ad3e799ef8df7395e765c0ae9218e6c5dStephan Bosch "From: user@domain.org\n"
e1a4ea6ad3e799ef8df7395e765c0ae9218e6c5dStephan Bosch "Date: Sat, 24 Mar 2017 23:00:00 +0200\n"
e1a4ea6ad3e799ef8df7395e765c0ae9218e6c5dStephan Bosch "Mime-Version: 1.0\n"
e1a4ea6ad3e799ef8df7395e765c0ae9218e6c5dStephan Bosch "Content-Type: text/plain; charset=us-ascii\n"
e1a4ea6ad3e799ef8df7395e765c0ae9218e6c5dStephan Bosch "--foo bar--\n"
e1a4ea6ad3e799ef8df7395e765c0ae9218e6c5dStephan Bosch "(\"text\" \"plain\" (\"charset\" \"us-ascii\") NIL NIL \"7bit\" 17 1 NIL NIL NIL NIL)(\"message\" \"rfc822\" NIL NIL NIL \"7bit\" 133 (\"Sat, 24 Mar 2017 23:00:00 +0200\" NIL ((NIL NIL \"user\" \"domain.org\")) ((NIL NIL \"user\" \"domain.org\")) ((NIL NIL \"user\" \"domain.org\")) NIL NIL NIL NIL NIL) (\"text\" \"plain\" (\"charset\" \"us-ascii\") NIL NIL \"7bit\" 6 1 NIL NIL NIL NIL) 6 NIL NIL NIL NIL) \"mixed\" (\"boundary\" \"foo bar\") NIL NIL NIL",
e1a4ea6ad3e799ef8df7395e765c0ae9218e6c5dStephan Bosch "(\"text\" \"plain\" (\"charset\" \"us-ascii\") NIL NIL \"7bit\" 17 1)(\"message\" \"rfc822\" NIL NIL NIL \"7bit\" 133 (\"Sat, 24 Mar 2017 23:00:00 +0200\" NIL ((NIL NIL \"user\" \"domain.org\")) ((NIL NIL \"user\" \"domain.org\")) ((NIL NIL \"user\" \"domain.org\")) NIL NIL NIL NIL NIL) (\"text\" \"plain\" (\"charset\" \"us-ascii\") NIL NIL \"7bit\" 6 1) 6) \"mixed\""
.message =
"Content-ID: <A.frop.example.com>\n"
"Content-ID: <B.frop.example.com>\n"
"(\"text\" \"plain\" (\"charset\" \"us-ascii\") \"<A.frop.example.com>\" \"Container message\" \"7bit\" 17 1 NIL NIL NIL NIL)(\"message\" \"rfc822\" NIL \"<B.frop.example.com>\" \"Forwarded\" \"7bit\" 133 (\"Sat, 24 Mar 2017 23:00:00 +0200\" NIL ((NIL NIL \"user\" \"domain.org\")) ((NIL NIL \"user\" \"domain.org\")) ((NIL NIL \"user\" \"domain.org\")) NIL NIL NIL NIL NIL) (\"text\" \"plain\" (\"charset\" \"us-ascii\") NIL NIL \"7bit\" 6 1 NIL NIL NIL NIL) 6 NIL NIL NIL NIL) \"mixed\" (\"boundary\" \"foo bar\") NIL NIL NIL",
.body =
"(\"text\" \"plain\" (\"charset\" \"us-ascii\") \"<A.frop.example.com>\" \"Container message\" \"7bit\" 17 1)(\"message\" \"rfc822\" NIL \"<B.frop.example.com>\" \"Forwarded\" \"7bit\" 133 (\"Sat, 24 Mar 2017 23:00:00 +0200\" NIL ((NIL NIL \"user\" \"domain.org\")) ((NIL NIL \"user\" \"domain.org\")) ((NIL NIL \"user\" \"domain.org\")) NIL NIL NIL NIL NIL) (\"text\" \"plain\" (\"charset\" \"us-ascii\") NIL NIL \"7bit\" 6 1) 6) \"mixed\""
.message =
"NqOqqgpdXV3Y2NhIGVz6+4PJyUlcXFxAFEV4vV709fVBrVZDpVL9eTo/aGVlhXl5efT5fDw/P2c4\n"
"HKbdbmd3dzdTIZDk6+srh4eHqdPpqNfrSZJGo5H7+/sMBoNUKpUpgUsAQCqVQq1WIxgMfgp/dXU1\n"
"W1sb/X5/3PlJwd/19vbG7e1tlpWVcXV19ftGJjk0NESbzRb33aeCy8zMhM/nSxgliUSCxsZGiKKI\n"
"aKDX62NDp9MhIyPjyz5x4SQxOjoKURTR29sLmUyG7Oxs+P1+WCwW7O7uQiKRQKvVQq/Xo7KyMgaS\n"
"(\"text\" \"plain\" (\"charset\" \"us-ascii\" \"format\" \"flowed\" \"delsp\" \"no\") NIL NIL \"7bit\" 881 12 NIL NIL (\"la\") NIL)(\"image\" \"png\" NIL NIL NIL \"base64\" 1390 NIL (\"attachment\" (\"filename\" \"pigeon.png\")) NIL NIL) \"mixed\" (\"boundary\" \"foo bar\") NIL NIL NIL",
.body =
"(\"text\" \"plain\" (\"charset\" \"us-ascii\" \"format\" \"flowed\" \"delsp\" \"no\") NIL NIL \"7bit\" 881 12)(\"image\" \"png\" NIL NIL NIL \"base64\" 1390) \"mixed\""
.message =
"Content-Location: http://example.com/test.txt\n"
"Content-Type: multipart/alternative; boundary=\"sub1\"\n"
"(\"text\" \"x-myown\" (\"charset\" \"us-ascii\" \"foo\" \"quoted\\\"string\") \"<foo@example.com>\" \"hellodescription\" \"7bit\" 7 1 \"Q2hlY2sgSW50ZWdyaXR5IQ==\" (\"inline\" (\"foo\" \"bar\")) (\"en\" \"fi\" \"se\") \"http://example.com/test.txt\")(\"message\" \"rfc822\" NIL NIL NIL \"7bit\" 412 (\"Sun, 12 Aug 2012 12:34:56 +0300\" \"submsg\" ((NIL NIL \"sub\" \"domain.org\")) ((NIL NIL \"sub\" \"domain.org\")) ((NIL NIL \"sub\" \"domain.org\")) ((NIL NIL \"sub-to1\" \"domain.org\")(NIL NIL \"sub-to2\" \"domain.org\")) NIL NIL NIL NIL) ((\"text\" \"html\" (\"charset\" \"us-ascii\") NIL NIL \"8bit\" 20 1 NIL NIL NIL NIL)(\"text\" \"plain\" (\"charset\" \"us-ascii\") NIL NIL \"7bit\" 21 1 NIL NIL NIL NIL) \"alternative\" (\"boundary\" \"sub1\") NIL NIL NIL) 21 NIL NIL NIL NIL) \"mixed\" (\"boundary\" \"foo bar\") NIL NIL NIL",
.body =
"(\"text\" \"x-myown\" (\"charset\" \"us-ascii\" \"foo\" \"quoted\\\"string\") \"<foo@example.com>\" \"hellodescription\" \"7bit\" 7 1)(\"message\" \"rfc822\" NIL NIL NIL \"7bit\" 412 (\"Sun, 12 Aug 2012 12:34:56 +0300\" \"submsg\" ((NIL NIL \"sub\" \"domain.org\")) ((NIL NIL \"sub\" \"domain.org\")) ((NIL NIL \"sub\" \"domain.org\")) ((NIL NIL \"sub-to1\" \"domain.org\")(NIL NIL \"sub-to2\" \"domain.org\")) NIL NIL NIL NIL) ((\"text\" \"html\" (\"charset\" \"us-ascii\") NIL NIL \"8bit\" 20 1)(\"text\" \"plain\" (\"charset\" \"us-ascii\") NIL NIL \"7bit\" 21 1) \"alternative\") 21) \"mixed\""
static struct message_part *
int ret;
if (parse_bodystructure) {
return parts;
static void test_imap_bodystructure_write(void)
test_end();
} T_END;
static void test_imap_bodystructure_parse(void)
const char *error;
int ret;
if (ret == 0) {
test_end();
} T_END;
int main(void)
static void (*const test_functions[])(void) = {