summaryrefslogtreecommitdiffstats
path: root/src/network
diff options
context:
space:
mode:
authorPeter Hartmann <peter.hartmann@nokia.com>2011-03-01 19:18:54 +0100
committerPeter Hartmann <peter.hartmann@nokia.com>2011-03-07 11:15:26 +0100
commitca70c91ccc11450b0e634fd6054f1497c7c2a6ed (patch)
tree14997a75e9dddb26e8a2fe139b5f48aefcf741a5 /src/network
parent3904e8cadc0c4a3c80c5958451f8f130f523ed08 (diff)
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/network')
-rw-r--r--src/network/access/qnetworkcookie.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/network/access/qnetworkcookie.cpp b/src/network/access/qnetworkcookie.cpp
index 3484217d9c..c2a69257c3 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;