Fixed 'body_fld_lang' optional in IMAP response.
This commit is contained in:
parent
674c3697f9
commit
a32bb6c954
@ -3743,8 +3743,8 @@ public:
|
||||
|
||||
//
|
||||
// body_ext_mpart ::= body_fld_param
|
||||
// [SPACE body_fld_dsp SPACE body_fld_lang
|
||||
// [SPACE 1#body_extension]]
|
||||
// [SPACE body_fld_dsp [SPACE body_fld_lang
|
||||
// [SPACE 1#body_extension]]]
|
||||
// ;; MUST NOT be returned on non-extensible
|
||||
// ;; "BODY" fetch
|
||||
|
||||
@ -3774,20 +3774,23 @@ public:
|
||||
|
||||
VIMAP_PARSER_GET(IMAPParser::body_fld_param, m_body_fld_param);
|
||||
|
||||
// [SPACE body_fld_dsp SPACE body_fld_lang [SPACE 1#body_extension]]
|
||||
// [SPACE body_fld_dsp [SPACE body_fld_lang [SPACE 1#body_extension]]]
|
||||
if (VIMAP_PARSER_TRY_CHECK(SPACE))
|
||||
{
|
||||
VIMAP_PARSER_GET(IMAPParser::body_fld_dsp, m_body_fld_dsp);
|
||||
VIMAP_PARSER_CHECK(SPACE);
|
||||
VIMAP_PARSER_GET(IMAPParser::body_fld_lang, m_body_fld_lang);
|
||||
|
||||
// [SPACE 1#body_extension]
|
||||
if (VIMAP_PARSER_TRY_CHECK(SPACE))
|
||||
{
|
||||
VIMAP_PARSER_GET_PUSHBACK(body_extension, m_body_extensions);
|
||||
VIMAP_PARSER_GET(IMAPParser::body_fld_lang, m_body_fld_lang);
|
||||
|
||||
while (VIMAP_PARSER_TRY_CHECK(SPACE))
|
||||
// [SPACE 1#body_extension]
|
||||
if (VIMAP_PARSER_TRY_CHECK(SPACE))
|
||||
{
|
||||
VIMAP_PARSER_GET_PUSHBACK(body_extension, m_body_extensions);
|
||||
|
||||
while (VIMAP_PARSER_TRY_CHECK(SPACE))
|
||||
VIMAP_PARSER_GET_PUSHBACK(body_extension, m_body_extensions);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -33,6 +33,7 @@ VMIME_TEST_SUITE_BEGIN(IMAPParserTest)
|
||||
VMIME_TEST(testExtraSpaceInCapaResponse)
|
||||
VMIME_TEST(testContinueReqWithoutSpace)
|
||||
VMIME_TEST(testNILValueInBodyFldEnc)
|
||||
VMIME_TEST(testFETCHResponse_optional_body_fld_lang)
|
||||
VMIME_TEST_LIST_END
|
||||
|
||||
|
||||
@ -142,4 +143,27 @@ VMIME_TEST_SUITE_BEGIN(IMAPParserTest)
|
||||
VASSERT_THROW("strict mode", parser->readResponse(), vmime::exceptions::invalid_response);
|
||||
}
|
||||
|
||||
// "body_fld_lang" is optional after "body_fld_dsp" in "body_ext_mpart" (Yahoo)
|
||||
void testFETCHResponse_optional_body_fld_lang()
|
||||
{
|
||||
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 = "* 1 FETCH (UID 7 RFC822.SIZE 694142 BODYSTRUCTURE (((\"text\" \"plain\" (\"charset\" \"utf-8\") NIL NIL \"7bit\" 0 0 NIL NIL NIL NIL)(\"text\" \"html\" (\"charset\" \"utf-8\") NIL NIL \"7bit\" 193 0 NIL NIL NIL NIL) \"alternative\" (\"boundary\" \"----=_Part_536_109505883.1410847112666\") NIL)(\"image\" \"jpeg\" NIL \"<4db20d0e-e9f8-729b-aaf7-688b5956d0bc@yahoo.com>\" NIL \"base64\" 351784 NIL (\"attachment\" (\"name\" \"att2\" \"filename\" \"9.jpg\")) NIL NIL)(\"image\" \"jpeg\" NIL \"<542417d7-c0ed-db72-f9fc-d9ab2c7e0a6f@yahoo.com>\" NIL \"base64\" 337676 NIL (\"attachment\" (\"name\" \"att3\" \"filename\" \"10.jpg\")) NIL NIL) \"mixed\" (\"boundary\" \"----=_Part_537_1371134700.1410847112668\") 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);
|
||||
|
||||
VASSERT_NO_THROW("parse", parser->readResponse());
|
||||
}
|
||||
|
||||
VMIME_TEST_SUITE_END
|
||||
|
Loading…
Reference in New Issue
Block a user