Patch by Zarafa <http://www.zarafa.com/> - which strips excessive spaces in parameterized headers. This was backported from upstream subversion. --- libvmime-0.7.1/src/parameterizedHeaderField.cpp 2005-06-03 13:09:11.000000000 +0200 +++ libvmime-0.7.1/src/parameterizedHeaderField.cpp.strip-spaces 2010-05-09 22:29:51.000000000 +0200 @@ -82,12 +82,31 @@ const string::value_type* const pstart = buffer.data() + position; const string::value_type* p = pstart; - const string::size_type start = position; + string::size_type valueStart = position; - while (p < pend && *p != ';') ++p; + while (p < pend && parserHelpers::isSpace(*p)) + { + ++p; + ++valueStart; + } + + // Advance up to ';', if any + string::size_type valueLength = 0; + + while (p < pend && *p != ';') // FIXME: support ";" inside quoted or RFC-2047-encoded text + { + ++p; + ++valueLength; + } + + // Trim whitespaces at the end of the value + while (valueLength > 0 && parserHelpers::isSpace(buffer[valueStart + valueLength - 1])) + --valueLength; - getValue().parse(buffer, start, position + (p - pstart)); + // Parse value + getValue().parse(buffer, valueStart, valueStart + valueLength); + // Reset parameters removeAllParameters(); // If there is one or more parameters following...