summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMårten Nordheim <marten.nordheim@qt.io>2017-10-17 15:16:40 +0200
committerMårten Nordheim <marten.nordheim@qt.io>2017-10-19 12:51:38 +0000
commitfc988786588bf86ebc46fdd12629efbec8ae1841 (patch)
treee9e7282ae40db56e6dd0c477dfa561701ceca79d /tests
parentf13e75345d035ec906846aaa3540454787edbd3f (diff)
Fix cookie path matching for empty url path
The path wouldn't match if the cookie's path was root ('/') and the URLs path was empty. Change-Id: I6dcd10f1fdf4f48f14e50f1b169cbdfda7005849 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/network/access/qnetworkcookiejar/tst_qnetworkcookiejar.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/auto/network/access/qnetworkcookiejar/tst_qnetworkcookiejar.cpp b/tests/auto/network/access/qnetworkcookiejar/tst_qnetworkcookiejar.cpp
index a0459021be..ed5d0c69a0 100644
--- a/tests/auto/network/access/qnetworkcookiejar/tst_qnetworkcookiejar.cpp
+++ b/tests/auto/network/access/qnetworkcookiejar/tst_qnetworkcookiejar.cpp
@@ -340,6 +340,17 @@ void tst_QNetworkCookieJar::cookiesForUrl_data()
QTest::newRow("no-match-domain-dot") << allCookies << "http://example.com" << result;
result += cookieDot;
QTest::newRow("match-domain-dot") << allCookies << "http://example.com." << result;
+
+ // Root path in cookie, empty url path
+ allCookies.clear();
+ QNetworkCookie rootCookie;
+ rootCookie.setName("a");
+ rootCookie.setPath("/");
+ rootCookie.setDomain("qt-project.org");
+ allCookies += rootCookie;
+ result.clear();
+ result += rootCookie;
+ QTest::newRow("root-path-match") << allCookies << "http://qt-project.org" << result;
}
void tst_QNetworkCookieJar::cookiesForUrl()