diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2011-10-04 02:06:31 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2011-10-04 02:06:31 (GMT) |
commit | ebfe394f21174b2ab1c37e809d2c35eb0de84508 (patch) | |
tree | 65d97c26741b52c83a315ef1b2ed713dee0a08dd /src | |
parent | 92f06c223ba2457e74944a786bed629bdf00ca4b (diff) | |
parent | 5d809703aa2d2a08ae7e9610fd42025b081d3d0c (diff) | |
download | Qt-ebfe394f21174b2ab1c37e809d2c35eb0de84508.zip Qt-ebfe394f21174b2ab1c37e809d2c35eb0de84508.tar.gz Qt-ebfe394f21174b2ab1c37e809d2c35eb0de84508.tar.bz2 |
Merge branch 'master' of scm.dev.nokia.troll.no:qt/qt-earth-staging into master-integration
* 'master' of scm.dev.nokia.troll.no:qt/qt-earth-staging:
QNetworkRequest autotest: adapt to new cookie parsing (re. commas)
Remove support for multiple cookies in one Set-Cookie header to follow RFC6265.
Diffstat (limited to 'src')
-rw-r--r-- | src/network/access/qnetworkcookie.cpp | 18 |
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); |