From 32eb1ebe34ae903b91ca0c77d616a07a2ba5afe6 Mon Sep 17 00:00:00 2001 From: Vincent Richard Date: Sun, 24 Mar 2013 15:50:16 +0100 Subject: Strip spaces at end of header lines (Zarafa). --- src/headerField.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/headerField.cpp b/src/headerField.cpp index 7d23ce84..1d33dac1 100644 --- a/src/headerField.cpp +++ b/src/headerField.cpp @@ -142,7 +142,7 @@ ref headerField::parseNext ++pos; const string::size_type contentsStart = pos; - string::size_type contentsEnd = end; + string::size_type contentsEnd = 0; // Extract the field value while (pos < end) @@ -215,6 +215,20 @@ ref headerField::parseNext } } + if (pos == end && contentsEnd == 0) + { + // End of data, and no CRLF was found at the end + contentsEnd = end; + } + + // Strip spaces from end of header lines + while (contentsEnd > contentsStart && + (buffer[contentsEnd - 1] == ' ' || buffer[contentsEnd - 1] == '\t' || + buffer[contentsEnd - 1] == '\r' || buffer[contentsEnd - 1] == '\n')) + { + contentsEnd--; + } + // Return a new field ref field = headerFieldFactory::getInstance()->create(name); -- cgit v1.2.3