diff options
author | Vincent Richard <[email protected]> | 2014-06-08 16:34:01 +0000 |
---|---|---|
committer | Vincent Richard <[email protected]> | 2014-06-08 16:34:01 +0000 |
commit | a46e520902de17f1ebedbe870d8c8f3eda4203c1 (patch) | |
tree | a11017dfdb30b76acbc66a44cd744cb94fde8d38 /tests | |
parent | Removed useless 'virtual' inheritance (fixed issue #84). (diff) | |
download | vmime-a46e520902de17f1ebedbe870d8c8f3eda4203c1.tar.gz vmime-a46e520902de17f1ebedbe870d8c8f3eda4203c1.zip |
Fixed issue #86: workaround for invalid response from Exchange server.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/net/imap/IMAPParserTest.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/net/imap/IMAPParserTest.cpp b/tests/net/imap/IMAPParserTest.cpp index b93e4b58..d98e89a0 100644 --- a/tests/net/imap/IMAPParserTest.cpp +++ b/tests/net/imap/IMAPParserTest.cpp @@ -32,6 +32,7 @@ VMIME_TEST_SUITE_BEGIN(IMAPParserTest) VMIME_TEST_LIST_BEGIN VMIME_TEST(testExtraSpaceInCapaResponse) VMIME_TEST(testContinueReqWithoutSpace) + VMIME_TEST(testNILValueInBodyFldEnc) VMIME_TEST_LIST_END @@ -107,4 +108,38 @@ VMIME_TEST_SUITE_BEGIN(IMAPParserTest) VASSERT_THROW("strict mode", parser->readResponse(), vmime::exceptions::invalid_response); } + // When an IMAP4 client sends a FETCH (bodystructure) request to a server + // that is running the Exchange Server 2007 IMAP4 service, a corrupted + // response is sent as a reply + // --> http://support.microsoft.com/kb/975918/en-us + void testNILValueInBodyFldEnc() + { + vmime::shared_ptr <testSocket> socket = vmime::make_shared <testSocket>(); + vmime::shared_ptr <vmime::net::timeoutHandler> toh = vmime::make_shared <testTimeoutHandler>(); + + vmime::shared_ptr <vmime::net::imap::IMAPTag> tag = + vmime::make_shared <vmime::net::imap::IMAPTag>(); + + const char* resp = "* 7970 FETCH (UID 8036 FLAGS () BODYSTRUCTURE (\"text\" \"html\" (\"charset\" \"utf-8\") NIL NIL NIL 175501 1651 NIL NIL NIL NIL) RFC822.HEADER {3}\r\nx\r\n)\r\na001 OK FETCH complete\r\n"; + + socket->localSend(resp); + + vmime::shared_ptr <vmime::net::imap::IMAPParser> parser = + vmime::make_shared <vmime::net::imap::IMAPParser>(); + + parser->setTag(tag); + parser->setSocket(socket); + parser->setTimeoutHandler(toh); + + parser->setStrict(false); + VASSERT_NO_THROW("non-strict mode", parser->readResponse()); + + ++(*tag); + + socket->localSend(resp); + + parser->setStrict(true); + VASSERT_THROW("strict mode", parser->readResponse(), vmime::exceptions::invalid_response); + } + VMIME_TEST_SUITE_END |