diff options
author | Vincent Richard <[email protected]> | 2005-04-19 11:13:50 +0000 |
---|---|---|
committer | Vincent Richard <[email protected]> | 2005-04-19 11:13:50 +0000 |
commit | 95508d3495a4034194f4c8a9dd7d83481bdffd13 (patch) | |
tree | f10b921842d274e6f5eea0776acbca370756d6de | |
parent | Fixed getLocaleCharset() in Windows platform handler, when MLang is not present. (diff) | |
download | vmime-95508d3495a4034194f4c8a9dd7d83481bdffd13.tar.gz vmime-95508d3495a4034194f4c8a9dd7d83481bdffd13.zip |
Fixed bug in RFC-2231 implementation.
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | src/defaultParameter.cpp | 9 |
2 files changed, 11 insertions, 3 deletions
@@ -2,6 +2,11 @@ VERSION 0.7.1cvs ================ +2005-04-19 Vincent Richard <[email protected]> + + * defaultParameter.cpp: fixed a bug in implementation of RFC-2231 (values + were cut if longer than maxLineLength, and no line wrapping occured). + 2005-04-15 Vincent Richard <[email protected]> * url.{hpp|cpp}, urlUtils.{hpp|cpp}: fixed a lot of bugs in URLs parsing diff --git a/src/defaultParameter.cpp b/src/defaultParameter.cpp index 796b4d49..d2110be2 100644 --- a/src/defaultParameter.cpp +++ b/src/defaultParameter.cpp @@ -191,15 +191,16 @@ void defaultParameter::generate(utility::outputStream& os, const string::size_ty // also generate a normal "7bit/us-ascii" parameter string::size_type pos = curLinePos; - if (pos + name.length() + 10 > maxLineLength) + if (pos + name.length() + 10 + value.length() > maxLineLength) { os << NEW_LINE_SEQUENCE; pos = NEW_LINE_SEQUENCE_LENGTH; } bool needQuoting = false; + string::size_type valueLength = 0; - for (string::size_type i = 0 ; (i < value.length()) && (pos < maxLineLength - 4) ; ++i) + for (string::size_type i = 0 ; (i < value.length()) && (pos < maxLineLength - 4) ; ++i, ++valueLength) { switch (value[i]) { @@ -228,6 +229,8 @@ void defaultParameter::generate(utility::outputStream& os, const string::size_ty } } + const bool cutValue = (valueLength != value.length()); // has the value been cut? + if (needQuoting) { os << name << "=\""; @@ -269,7 +272,7 @@ void defaultParameter::generate(utility::outputStream& os, const string::size_ty // Also generate an extended parameter if the value contains 8-bit characters // or is too long for a single line - if (extended || (value.length() >= (maxLineLength - name.length() + 3))) + if (extended || cutValue) { os << ';'; ++pos; |