summaryrefslogtreecommitdiffstats
path: root/src/network/access
diff options
context:
space:
mode:
authorJocelyn Turcotte <jocelyn.turcotte@nokia.com>2011-09-14 14:12:10 (GMT)
committerJocelyn Turcotte <jocelyn.turcotte@nokia.com>2011-09-16 12:43:08 (GMT)
commit8ba781b01e900148fec2e9d26485369b3295487f (patch)
tree73a6a2c72ba7191ff93d39e9e7cd6bc6c904be8a /src/network/access
parentad35d25e78c8252a72108a4ba931934047c4707e (diff)
downloadQt-8ba781b01e900148fec2e9d26485369b3295487f.zip
Qt-8ba781b01e900148fec2e9d26485369b3295487f.tar.gz
Qt-8ba781b01e900148fec2e9d26485369b3295487f.tar.bz2
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
Diffstat (limited to 'src/network/access')
-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 0670738..a9bb318 100644
--- a/src/network/access/qnetworkcookie.cpp
+++ b/src/network/access/qnetworkcookie.cpp
@@ -372,7 +372,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;
}
@@ -423,7 +423,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;
@@ -434,7 +434,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;
}
@@ -461,8 +461,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.
@@ -488,7 +487,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('"'))) {
@@ -967,14 +965,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);