# HG changeset patch # User Mark Brand # Date 1277388815 -7200 # Node ID 102005845debb82494ef09aeded2284a9003f1aa # Parent 75fee64528ad71567ce1cbad91eb8d49746a222a upgrade package vmime to vmime-0.9.1-svn-r556 r556 | vincent-richard | 2010-06-23 22:42:25 +0200 (Wed, 23 Jun 2010) | 1 line Do not generate 7-bit value for parameter if RFC-2231 extended value is generated (thanks to Eugene A. Shatokhin). diff --git a/src/vmime-0.9.1-svn-r556-20100623.patch b/src/vmime-0.9.1-svn-r556-20100623.patch new file mode 100644 --- /dev/null +++ b/src/vmime-0.9.1-svn-r556-20100623.patch @@ -0,0 +1,112 @@ +This file is part of mingw-cross-env. +See doc/index.html for further information. + +diff -urN a/src/parameter.cpp b/src/parameter.cpp +--- a/src/parameter.cpp 2010-06-24 16:10:35.243747924 +0200 ++++ b/src/parameter.cpp 2010-06-24 16:10:52.299742493 +0200 +@@ -257,11 +257,23 @@ + + // For compatibility with implementations that do not understand RFC-2231, + // also generate a normal "7bit/us-ascii" parameter ++ ++ // [By Eugene A. Shatokhin] ++ // Note that if both the normal "7bit/us-ascii" value and the extended ++ // value are present, the latter can be ignored by mail processing systems. ++ // This may lead to annoying problems, for example, with strange names of ++ // attachments with all but 7-bit ascii characters removed, etc. To avoid ++ // this, I would suggest not to create "7bit/us-ascii" value if the extended ++ // value is to be generated. ++ ++ // A stream for a temporary storage ++ std::ostringstream sevenBitBuffer; ++ + string::size_type pos = curLinePos; + + if (pos + name.length() + 10 + value.length() > maxLineLength) + { +- os << NEW_LINE_SEQUENCE; ++ sevenBitBuffer << NEW_LINE_SEQUENCE; + pos = NEW_LINE_SEQUENCE_LENGTH; + } + +@@ -301,12 +313,12 @@ + + if (needQuoting) + { +- os << name << "=\""; ++ sevenBitBuffer << name << "=\""; + pos += name.length() + 2; + } + else + { +- os << name << "="; ++ sevenBitBuffer << name << "="; + pos += name.length() + 1; + } + +@@ -318,12 +330,12 @@ + + if (/* needQuoting && */ (c == '"' || c == '\\')) // 'needQuoting' is implicit + { +- os << '\\' << value[i]; // escape 'x' with '\x' ++ sevenBitBuffer << '\\' << value[i]; // escape 'x' with '\x' + pos += 2; + } + else if (parserHelpers::isAscii(c)) + { +- os << value[i]; ++ sevenBitBuffer << value[i]; + ++pos; + } + else +@@ -334,17 +346,31 @@ + + if (needQuoting) + { +- os << '"'; ++ sevenBitBuffer << '"'; + ++pos; + } + ++#if VMIME_ALWAYS_GENERATE_7BIT_PARAMETER ++ os << sevenBitBuffer; ++#endif // !VMIME_ALWAYS_GENERATE_7BIT_PARAMETER ++ + // Also generate an extended parameter if the value contains 8-bit characters + // or is too long for a single line + if (extended || cutValue) + { ++ ++#if VMIME_ALWAYS_GENERATE_7BIT_PARAMETER ++ + os << ';'; + ++pos; + ++#else // !VMIME_ALWAYS_GENERATE_7BIT_PARAMETER ++ ++ // The data output to 'sevenBitBuffer' will be discarded in this case ++ pos = curLinePos; ++ ++#endif // VMIME_ALWAYS_GENERATE_7BIT_PARAMETER ++ + /* RFC-2231 + * ======== + * +@@ -477,6 +503,17 @@ + } + } + } ++#if !VMIME_ALWAYS_GENERATE_7BIT_PARAMETER ++ else ++ { ++ // The value does not contain 8-bit characters and ++ // is short enough for a single line. ++ // "7bit/us-ascii" will suffice in this case. ++ ++ // Output what has been stored in temporary buffer so far ++ os << sevenBitBuffer.str(); ++ } ++#endif // !VMIME_ALWAYS_GENERATE_7BIT_PARAMETER + + if (newLinePos) + *newLinePos = pos;