diff options
author | Peter Hartmann <peter.hartmann@nokia.com> | 2011-03-01 18:18:54 (GMT) |
---|---|---|
committer | Peter Hartmann <peter.hartmann@nokia.com> | 2011-03-07 10:15:26 (GMT) |
commit | ca70c91ccc11450b0e634fd6054f1497c7c2a6ed (patch) | |
tree | 14997a75e9dddb26e8a2fe139b5f48aefcf741a5 /src | |
parent | 3904e8cadc0c4a3c80c5958451f8f130f523ed08 (diff) | |
download | Qt-ca70c91ccc11450b0e634fd6054f1497c7c2a6ed.zip Qt-ca70c91ccc11450b0e634fd6054f1497c7c2a6ed.tar.gz Qt-ca70c91ccc11450b0e634fd6054f1497c7c2a6ed.tar.bz2 |
QNetworkCookie: fix quoted values
Do not strip quotes etc. from cookie values; from the RFC 2109:
"The VALUE is opaque to the user agent (...)".
In addition, escaped quotes are allowed in quoted values.
Reviewed-by: Markus Goetz
Task-number: QTBUG-17746
Diffstat (limited to 'src')
-rw-r--r-- | src/network/access/qnetworkcookie.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/network/access/qnetworkcookie.cpp b/src/network/access/qnetworkcookie.cpp index 3484217..c2a6925 100644 --- a/src/network/access/qnetworkcookie.cpp +++ b/src/network/access/qnetworkcookie.cpp @@ -397,21 +397,24 @@ static QPair<QByteArray, QByteArray> nextField(const QByteArray &text, int &posi // If its NAME=VALUE, retain the value as is // refer to ttp://bugreports.qt.nokia.com/browse/QTBUG-17746 - if (!isNameValue) - ++i; + if (isNameValue) + second += '"'; + ++i; while (i < length) { register char c = text.at(i); - if (c == '"' && !isNameValue) { + if (c == '"') { // end of quoted text + if (isNameValue) + second += '"'; break; } else if (c == '\\') { + if (isNameValue) + second += '\\'; ++i; if (i >= length) // broken line return qMakePair(QByteArray(), QByteArray()); c = text.at(i); - } else if ((c == ';' || c == ',') && isNameValue) { - break; } second += c; |