summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJocelyn Turcotte <jocelyn.turcotte@nokia.com>2011-09-14 16:12:10 +0200
committerQt by Nokia <qt-info@nokia.com>2012-06-27 00:46:35 +0200
commit297a25cc4bdfb925eaaa2cc940053718a9519dae (patch)
tree7eb46f4fce68c6a51af81ef471aab91a7cace1f7 /src
parente1402c0d278b4570444e3e20b93fd5ab5619c8fc (diff)
Remove support for multiple cookies in one Set-Cookie header to follow RFC6265.
This also allows cookie values to contain commas to increase compatibility like most popular browsers do even though the RFC still reserves them for future uses. Reviewed-by: Peter Hartmann <peter.hartmann@nokia.com> Task-number: QTBUG-21456 (cherry-picked from 8ba781b01e900148fec2e9d26485369b3295487f) Change-Id: Ib09ab2411dddf7f99de1c0c31680428b7412fc7e Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
Diffstat (limited to 'src')
-rw-r--r--src/network/access/qnetworkcookie.cpp18
1 files changed, 5 insertions, 13 deletions
diff --git a/src/network/access/qnetworkcookie.cpp b/src/network/access/qnetworkcookie.cpp
index b3324a1992..6a2a70f0b5 100644
--- a/src/network/access/qnetworkcookie.cpp
+++ b/src/network/access/qnetworkcookie.cpp
@@ -386,7 +386,7 @@ static QPair<QByteArray, QByteArray> nextField(const QByteArray &text, int &posi
// parse the first part, before the equal sign
for (i = position; i < length; ++i) {
register char c = text.at(i);
- if (c == ';' || c == ',' || c == '=')
+ if (c == ';' || c == '=')
break;
}
@@ -437,7 +437,7 @@ static QPair<QByteArray, QByteArray> nextField(const QByteArray &text, int &posi
for ( ; i < length; ++i) {
register char c = text.at(i);
- if (c == ',' || c == ';')
+ if (c == ';')
break;
}
position = i;
@@ -448,7 +448,7 @@ static QPair<QByteArray, QByteArray> nextField(const QByteArray &text, int &posi
register char c = text.at(i);
// for name value pairs, we want to parse until reaching the next ';'
// and not break when reaching a space char
- if (c == ',' || c == ';' || ((isNameValue && (c == '\n' || c == '\r')) || (!isNameValue && isLWS(c))))
+ if (c == ';' || ((isNameValue && (c == '\n' || c == '\r')) || (!isNameValue && isLWS(c))))
break;
}
@@ -475,8 +475,7 @@ static QPair<QByteArray, QByteArray> nextField(const QByteArray &text, int &posi
\value Full makes toRawForm() return the full
cookie contents, as suitable for sending to a client in a
- server's "Set-Cookie:" header. Multiple cookies are separated
- by commas in a "Set-Cookie:" header.
+ server's "Set-Cookie:" header.
Note that only the Full form of the cookie can be parsed back into
its original contents.
@@ -502,7 +501,6 @@ QByteArray QNetworkCookie::toRawForm(RawForm form) const
result = d->name;
result += '=';
if ((d->value.contains(';') ||
- d->value.contains(',') ||
d->value.contains('"')) &&
(!d->value.startsWith('"') &&
!d->value.endsWith('"'))) {
@@ -981,14 +979,8 @@ QList<QNetworkCookie> QNetworkCookiePrivate::parseSetCookieHeaderLine(const QByt
cookie.setValue(field.second);
position = nextNonWhitespace(cookieString, position);
- bool endOfCookie = false;
- while (!endOfCookie && position < length) {
+ while (position < length) {
switch (cookieString.at(position++)) {
- case ',':
- // end of the cookie
- endOfCookie = true;
- break;
-
case ';':
// new field in the cookie
field = nextField(cookieString, position, false);