diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2011-03-08 18:26:03 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2011-03-08 18:26:03 (GMT) |
commit | aea684027cb0c0fa75dd3f3f72b1dc88bdf39c2c (patch) | |
tree | 8b332a299d929dbda9e0229fb1a17a9e92182b86 | |
parent | 84df1620b1b2e648c4980e7186aa1cb060b59729 (diff) | |
parent | c0756297da324069839622217e3cb38c8a745e33 (diff) | |
download | Qt-aea684027cb0c0fa75dd3f3f72b1dc88bdf39c2c.zip Qt-aea684027cb0c0fa75dd3f3f72b1dc88bdf39c2c.tar.gz Qt-aea684027cb0c0fa75dd3f3f72b1dc88bdf39c2c.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1:
Fix possible bearer management Crash with Panic E32USER-CBase, 69
QNetworkCookie: fix quoted values
Fix for QTBUG-17746. Quotes is retained in cookie value
Unsuccessful unlocking of QNetworkConfigurationPrivate mutex
-rw-r--r-- | src/network/access/qnetworkcookie.cpp | 21 | ||||
-rw-r--r-- | src/plugins/bearer/symbian/symbianengine.cpp | 12 | ||||
-rw-r--r-- | tests/auto/qnetworkcookie/tst_qnetworkcookie.cpp | 24 |
3 files changed, 38 insertions, 19 deletions
diff --git a/src/network/access/qnetworkcookie.cpp b/src/network/access/qnetworkcookie.cpp index 70ea5c2..c2a6925 100644 --- a/src/network/access/qnetworkcookie.cpp +++ b/src/network/access/qnetworkcookie.cpp @@ -359,7 +359,7 @@ void QNetworkCookie::setValue(const QByteArray &value) } // ### move this to qnetworkcookie_p.h and share with qnetworkaccesshttpbackend -static QPair<QByteArray, QByteArray> nextField(const QByteArray &text, int &position) +static QPair<QByteArray, QByteArray> nextField(const QByteArray &text, int &position, bool isNameValue) { // format is one of: // (1) token @@ -394,13 +394,22 @@ static QPair<QByteArray, QByteArray> nextField(const QByteArray &text, int &posi // quoted-string = ( <"> *(qdtext | quoted-pair ) <"> ) // qdtext = <any TEXT except <">> // quoted-pair = "\" CHAR + + // If its NAME=VALUE, retain the value as is + // refer to ttp://bugreports.qt.nokia.com/browse/QTBUG-17746 + if (isNameValue) + second += '"'; ++i; while (i < length) { register char c = text.at(i); if (c == '"') { // end of quoted text + if (isNameValue) + second += '"'; break; } else if (c == '\\') { + if (isNameValue) + second += '\\'; ++i; if (i >= length) // broken line @@ -476,10 +485,12 @@ QByteArray QNetworkCookie::toRawForm(RawForm form) const result = d->name; result += '='; - if (d->value.contains(';') || + if ((d->value.contains(';') || d->value.contains(',') || d->value.contains(' ') || - d->value.contains('"')) { + d->value.contains('"')) && + (!d->value.startsWith('"') && + !d->value.endsWith('"'))) { result += '"'; QByteArray value = d->value; @@ -947,7 +958,7 @@ QList<QNetworkCookie> QNetworkCookiePrivate::parseSetCookieHeaderLine(const QByt QNetworkCookie cookie; // The first part is always the "NAME=VALUE" part - QPair<QByteArray,QByteArray> field = nextField(cookieString, position); + QPair<QByteArray,QByteArray> field = nextField(cookieString, position, true); if (field.first.isEmpty() || field.second.isNull()) // parsing error break; @@ -965,7 +976,7 @@ QList<QNetworkCookie> QNetworkCookiePrivate::parseSetCookieHeaderLine(const QByt case ';': // new field in the cookie - field = nextField(cookieString, position); + field = nextField(cookieString, position, false); field.first = field.first.toLower(); // everything but the NAME=VALUE is case-insensitive if (field.first == "expires") { diff --git a/src/plugins/bearer/symbian/symbianengine.cpp b/src/plugins/bearer/symbian/symbianengine.cpp index fc480c2..f367c26 100644 --- a/src/plugins/bearer/symbian/symbianengine.cpp +++ b/src/plugins/bearer/symbian/symbianengine.cpp @@ -150,16 +150,15 @@ SymbianEngine::~SymbianEngine() iConnectionMonitor.CancelNotifications(); iConnectionMonitor.Close(); - -#ifdef SNAP_FUNCTIONALITY_AVAILABLE - iCmManager.Close(); -#endif - - // CCommsDatabase destructor uses cleanup stack. Since QNetworkConfigurationManager + + // CCommsDatabase destructor and RCmManager.Close() use cleanup stack. Since QNetworkConfigurationManager // is a global static, but the time we are here, E32Main() has been exited already and // the thread's default cleanup stack has been deleted. Without this line, a // 'E32USER-CBase 69' -panic will occur. CTrapCleanup* cleanup = CTrapCleanup::New(); +#ifdef SNAP_FUNCTIONALITY_AVAILABLE + iCmManager.Close(); +#endif delete ipCommsDB; delete cleanup; } @@ -829,6 +828,7 @@ void SymbianEngine::updateStatesToSnaps() discovered = true; } } + snapConfigLocker.unlock(); if (active) { changeConfigurationStateTo(ptr, QNetworkConfiguration::Active); } else if (discovered) { diff --git a/tests/auto/qnetworkcookie/tst_qnetworkcookie.cpp b/tests/auto/qnetworkcookie/tst_qnetworkcookie.cpp index 0c89013..91dfe47 100644 --- a/tests/auto/qnetworkcookie/tst_qnetworkcookie.cpp +++ b/tests/auto/qnetworkcookie/tst_qnetworkcookie.cpp @@ -171,16 +171,16 @@ void tst_QNetworkCookie::parseSingleCookie_data() QTest::newRow("with-value7") << "a = b" << cookie; QTest::newRow("with-value8") << "a = b " << cookie; - cookie.setValue(","); + cookie.setValue("\",\""); QTest::newRow("with-value-with-special1") << "a = \",\" " << cookie; - cookie.setValue(";"); + cookie.setValue("\";\""); QTest::newRow("with-value-with-special2") << "a = \";\" " << cookie; - cookie.setValue(" "); + cookie.setValue("\" \""); QTest::newRow("with-value-with-special3") << "a = \" \" " << cookie; - cookie.setValue("\""); - QTest::newRow("with-value-with-special3") << "a = \"\\\"\" " << cookie; - cookie.setValue("\"a, b; c\""); - QTest::newRow("with-value-with-special4") << "a = \"\\\"a, b; c\\\"\"" << cookie; + cookie.setValue("\"\\\"\""); + QTest::newRow("with-value-with-special4") << "a = \"\\\"\" " << cookie; + cookie.setValue("\"\\\"a, b; c\\\"\""); + QTest::newRow("with-value-with-special5") << "a = \"\\\"a, b; c\\\"\"" << cookie; cookie.setValue("b"); cookie.setSecure(true); @@ -568,10 +568,18 @@ void tst_QNetworkCookie::parseSingleCookie_data() cookie.setDomain("mail.yahoo.com"); QTest::newRow("network3") << "YM.LC=v=2&m=9993_262838_159_1558_1063_0_5649_4012_3776161073,9426_260205_549_1295_1336_0_5141_4738_3922731647,6733_258196_952_1364_643_0_3560_-1_0,3677_237633_1294_1294_19267_0_3244_29483_4102206176,1315_235149_1693_1541_941_0_3224_1691_1861378060,1858_214311_2100_1298_19538_0_2873_30900_716411652,6258_212007_2506_1285_1017_0_2868_3606_4288540264,3743_207884_2895_1362_2759_0_2545_7114_3388520216,2654_205253_3257_1297_1332_0_2504_4682_3048534803,1891_184881_3660_1291_19079_0_978_29178_2592538685&f=1&n=20&s=date&o=down&e=1196548712&b=Inbox&u=removed; path=/; domain=mail.yahoo.com" << cookie; - cookie = QNetworkCookie("__ac", "c2hhdXNtYW46U2FTYW80Wm8%3D"); + cookie = QNetworkCookie("__ac", "\"c2hhdXNtYW46U2FTYW80Wm8%3D\""); cookie.setPath("/"); cookie.setExpirationDate(QDateTime(QDate(2008, 8, 30), QTime(20, 21, 49), Qt::UTC)); QTest::newRow("network4") << "__ac=\"c2hhdXNtYW46U2FTYW80Wm8%3D\"; Path=/; Expires=Sat, 30 Aug 2008 20:21:49 +0000" << cookie; + + // linkedin.com sends cookies in quotes and expects the cookie in quotes + cookie = QNetworkCookie("leo_auth_token", "\"GST:UroVXaxYA3sVSkoVjMNH9bj4dZxVzK2yekgrAUxMfUsyLTNyPjoP60:1298974875:b675566ae32ab36d7a708c0efbf446a5c22b9fca\""); + cookie.setPath("/"); + cookie.setExpirationDate(QDateTime(QDate(2011, 3, 1), QTime(10, 51, 14), Qt::UTC)); + QTest::newRow("network5") << "leo_auth_token=\"GST:UroVXaxYA3sVSkoVjMNH9bj4dZxVzK2yekgrAUxMfUsyLTNyPjoP60:1298974875:b675566ae32ab36d7a708c0efbf446a5c22b9fca\"; Version=1; Max-Age=1799; Expires=Tue, 01-Mar-2011 10:51:14 GMT; Path=/" << cookie; + + } void tst_QNetworkCookie::parseSingleCookie() |