summaryrefslogtreecommitdiff
path: root/tests/cookies-test.c
diff options
context:
space:
mode:
authorPatrick Griffis <pgriffis@igalia.com>2023-01-22 17:35:03 -0600
committerPatrick Griffis <pgriffis@igalia.com>2023-01-23 09:51:15 -0600
commitcf5ce3ece31bcf952afa86c53107ed94ec55b80e (patch)
treedb615b4c2d61da480c09d59dc376090c4427e7a9 /tests/cookies-test.c
parente14136ebef1dd48271cebd95120ffd122079d05c (diff)
downloadlibsoup-cf5ce3ece31bcf952afa86c53107ed94ec55b80e.tar.gz
cookie-jar: Fix valid Secure cookies being rejected
The documentation for soup_cookie_jar_add_cookie_full() states NULL uris are always treated as a secure origin.
Diffstat (limited to 'tests/cookies-test.c')
-rw-r--r--tests/cookies-test.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/tests/cookies-test.c b/tests/cookies-test.c
index 2780e0ad..cafa26e4 100644
--- a/tests/cookies-test.c
+++ b/tests/cookies-test.c
@@ -301,6 +301,10 @@ do_cookies_prefix_test (void)
soup_cookie_jar_add_cookie_full (jar, soup_cookie_parse ("__SeCuRe-Valid-1=1; Path=/; Secure", secure_uri),
secure_uri, NULL);
+ /* With NULL uri is considered secure */
+ soup_cookie_jar_add_cookie_full (jar, soup_cookie_parse ("__secure-Valid-2=1; Path=/; Secure", secure_uri),
+ NULL, NULL);
+
/* Without Secure */
soup_cookie_jar_add_cookie_full (jar, soup_cookie_parse ("__SeCuRe-Invalid-1=1;", secure_uri),
secure_uri, NULL);
@@ -312,6 +316,9 @@ do_cookies_prefix_test (void)
soup_cookie_jar_add_cookie_full (jar, soup_cookie_parse ("__HoSt-Valid-1=1; Path=/; Secure", secure_uri),
secure_uri, NULL);
+ soup_cookie_jar_add_cookie_full (jar, soup_cookie_parse ("__HoSt-Valid-2=1; Path=/; Secure", secure_uri),
+ NULL, NULL);
+
/* Invalid Path */
soup_cookie_jar_add_cookie_full (jar, soup_cookie_parse ("__HOST-Invalid-1=1; Path=/Somethingelse; Secure", secure_uri),
secure_uri, NULL);
@@ -336,8 +343,8 @@ do_cookies_prefix_test (void)
g_assert_true (strstr (soup_cookie_get_name (cookie), "Valid") != NULL);
}
- /* In total we expect 2 valid cookies above. */
- g_assert_cmpuint (g_slist_length (cookies), ==, 2);
+ /* In total we expect 4 valid cookies above. */
+ g_assert_cmpuint (g_slist_length (cookies), ==, 4);
g_slist_free_full (cookies, (GDestroyNotify)soup_cookie_free);
g_uri_unref (insecure_uri);