From df32418df5af976566e6eecb2777ccab7eadf5b3 Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Fri, 4 Oct 2019 22:51:05 +0200 Subject: Disregard whitespace between leading boundary hyphens and marker MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The way I read the RFC is that whitespace is not allowed before the boundary marker, only afterwards, so the checks for leading WS are removed, and the missing check for trailing WS is added. See RFC 2046 ยง5.1.1: """The boundary delimiter line is then defined as a line consisting entirely of two hyphen characters ("-", decimal value 45) followed by the boundary parameter value from the Content-Type header field, optional linear whitespace, and a terminating CRLF.""" --- tests/parser/bodyPartTest.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'tests/parser') diff --git a/tests/parser/bodyPartTest.cpp b/tests/parser/bodyPartTest.cpp index 91742553..062007d9 100644 --- a/tests/parser/bodyPartTest.cpp +++ b/tests/parser/bodyPartTest.cpp @@ -213,9 +213,9 @@ VMIME_TEST_SUITE_BEGIN(bodyPartTest) vmime::string str = "Content-Type: multipart/mixed; boundary=\"MY-BOUNDARY\"" "\r\n\r\n" - "-- \t MY-BOUNDARY\r\nHEADER1\r\n\r\nBODY1\r\n" + "--MY-BOUNDARY \t \r\nHEADER1\r\n\r\nBODY1\r\n" "--MY-BOUNDARY\r\n" - "-- MY-BOUNDARY--\r\n"; + "--MY-BOUNDARY-- \r\n"; vmime::bodyPart p; p.parse(str); @@ -291,7 +291,7 @@ VMIME_TEST_SUITE_BEGIN(bodyPartTest) vmime::string str = "Content-Type: multipart/mixed" "\r\n\r\n" - "-- \t UNKNOWN-BOUNDARY\r\nHEADER1\r\n\r\nBODY1\r\n" + "--UNKNOWN-BOUNDARY \t \r\nHEADER1\r\n\r\nBODY1\r\n" "--UNKNOWN-BOUNDARY\r\nHEADER2\r\n\r\nBODY2\r\n" "--UNKNOWN-BOUNDARY--"; -- cgit