Fixed bug in RFC-2231 implementation.
This commit is contained in:
parent
49fee23e26
commit
95508d3495
@ -2,6 +2,11 @@
|
||||
VERSION 0.7.1cvs
|
||||
================
|
||||
|
||||
2005-04-19 Vincent Richard <vincent@vincent-richard.net>
|
||||
|
||||
* 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 <vincent@vincent-richard.net>
|
||||
|
||||
* url.{hpp|cpp}, urlUtils.{hpp|cpp}: fixed a lot of bugs in URLs parsing
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user