diff options
author | Benjamin Gilbert <bgilbert@backtick.net> | 2013-06-17 23:28:35 +0200 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2013-06-17 23:28:35 +0200 |
commit | 03a3dd9ee39e2ca4eea101360ae976e13586c01a (patch) | |
tree | 168d4e6b5c5b5b20dde2e961a756a07f5daf7302 /tests | |
parent | 5fc24a5297e642a2e7056ac670398556928fd49a (diff) |
test506: verify that CURLOPT_COOKIELIST takes share lock
It doesn't right now: http://curl.haxx.se/bug/view.cgi?id=1215
Diffstat (limited to 'tests')
-rw-r--r-- | tests/data/test506 | 91 | ||||
-rw-r--r-- | tests/libtest/lib506.c | 28 |
2 files changed, 88 insertions, 31 deletions
diff --git a/tests/data/test506 b/tests/data/test506 index a61e2fc00..630e81651 100644 --- a/tests/data/test506 +++ b/tests/data/test506 @@ -80,45 +80,47 @@ CURLSHOPT_UNLOCKFUNC CURLSHOPT_USERDATA CURL_LOCK_DATA_COOKIE CURL_LOCK_DATA_DNS -*** run 1 CURLOPT_SHARE lock: share [Pigs in space]: 0 unlock: share [Pigs in space]: 1 -PERFORM -lock: dns [Pigs in space]: 2 -unlock: dns [Pigs in space]: 3 -lock: dns [Pigs in space]: 4 -unlock: dns [Pigs in space]: 5 +CURLOPT_COOKIELIST injected_and_clobbered +lock: cookie [Pigs in space]: 2 +unlock: cookie [Pigs in space]: 3 +CURLOPT_COOKIELIST ALL +lock: cookie [Pigs in space]: 4 +unlock: cookie [Pigs in space]: 5 +CURLOPT_COOKIELIST session lock: cookie [Pigs in space]: 6 unlock: cookie [Pigs in space]: 7 +CURLOPT_COOKIELIST injected lock: cookie [Pigs in space]: 8 unlock: cookie [Pigs in space]: 9 +CURLOPT_COOKIELIST SESS lock: cookie [Pigs in space]: 10 unlock: cookie [Pigs in space]: 11 +CLEANUP lock: cookie [Pigs in space]: 12 unlock: cookie [Pigs in space]: 13 -run 1: set cookie 1, 2 and 3 -lock: dns [Pigs in space]: 14 -unlock: dns [Pigs in space]: 15 -CLEANUP -lock: cookie [Pigs in space]: 16 -unlock: cookie [Pigs in space]: 17 -lock: share [Pigs in space]: 18 -unlock: share [Pigs in space]: 19 -*** run 2 +lock: share [Pigs in space]: 14 +unlock: share [Pigs in space]: 15 +*** run 1 CURLOPT_SHARE -lock: share [Pigs in space]: 20 -unlock: share [Pigs in space]: 21 +lock: share [Pigs in space]: 16 +unlock: share [Pigs in space]: 17 PERFORM -lock: dns [Pigs in space]: 22 -unlock: dns [Pigs in space]: 23 +lock: dns [Pigs in space]: 18 +unlock: dns [Pigs in space]: 19 +lock: dns [Pigs in space]: 20 +unlock: dns [Pigs in space]: 21 +lock: cookie [Pigs in space]: 22 +unlock: cookie [Pigs in space]: 23 lock: cookie [Pigs in space]: 24 unlock: cookie [Pigs in space]: 25 lock: cookie [Pigs in space]: 26 unlock: cookie [Pigs in space]: 27 lock: cookie [Pigs in space]: 28 unlock: cookie [Pigs in space]: 29 -run 2: set cookie 4 and 5 +run 1: set cookie 1, 2 and 3 lock: dns [Pigs in space]: 30 unlock: dns [Pigs in space]: 31 CLEANUP @@ -126,11 +128,10 @@ lock: cookie [Pigs in space]: 32 unlock: cookie [Pigs in space]: 33 lock: share [Pigs in space]: 34 unlock: share [Pigs in space]: 35 -*** run 3 +*** run 2 CURLOPT_SHARE lock: share [Pigs in space]: 36 unlock: share [Pigs in space]: 37 -CURLOPT_COOKIEJAR PERFORM lock: dns [Pigs in space]: 38 unlock: dns [Pigs in space]: 39 @@ -140,21 +141,48 @@ lock: cookie [Pigs in space]: 42 unlock: cookie [Pigs in space]: 43 lock: cookie [Pigs in space]: 44 unlock: cookie [Pigs in space]: 45 -run 3: overwrite cookie 1 and 4 +run 2: set cookie 4 and 5 lock: dns [Pigs in space]: 46 unlock: dns [Pigs in space]: 47 -try SHARE_CLEANUP... -lock: share [Pigs in space]: 48 -unlock: share [Pigs in space]: 49 -SHARE_CLEANUP failed, correct CLEANUP -lock: cookie [Pigs in space]: 50 -unlock: cookie [Pigs in space]: 51 +lock: cookie [Pigs in space]: 48 +unlock: cookie [Pigs in space]: 49 +lock: share [Pigs in space]: 50 +unlock: share [Pigs in space]: 51 +*** run 3 +CURLOPT_SHARE lock: share [Pigs in space]: 52 unlock: share [Pigs in space]: 53 +CURLOPT_COOKIEJAR +CURLOPT_COOKIELIST FLUSH +lock: cookie [Pigs in space]: 54 +lock: cookie [Pigs in space]: 55 +unlock: cookie [Pigs in space]: 56 +unlock: cookie [Pigs in space]: 57 +PERFORM +lock: dns [Pigs in space]: 58 +unlock: dns [Pigs in space]: 59 +lock: cookie [Pigs in space]: 60 +unlock: cookie [Pigs in space]: 61 +lock: cookie [Pigs in space]: 62 +unlock: cookie [Pigs in space]: 63 +lock: cookie [Pigs in space]: 64 +unlock: cookie [Pigs in space]: 65 +run 3: overwrite cookie 1 and 4 +lock: dns [Pigs in space]: 66 +unlock: dns [Pigs in space]: 67 +try SHARE_CLEANUP... +lock: share [Pigs in space]: 68 +unlock: share [Pigs in space]: 69 +SHARE_CLEANUP failed, correct +CLEANUP +lock: cookie [Pigs in space]: 70 +unlock: cookie [Pigs in space]: 71 +lock: share [Pigs in space]: 72 +unlock: share [Pigs in space]: 73 SHARE_CLEANUP -lock: share [Pigs in space]: 54 -unlock: share [Pigs in space]: 55 +lock: share [Pigs in space]: 74 +unlock: share [Pigs in space]: 75 GLOBAL_CLEANUP </stdout> <stderr> @@ -165,6 +193,7 @@ http://%HOSTIP:%HTTPPORT/506 # http://curl.haxx.se/docs/http-cookies.html # This file was generated by libcurl! Edit at your own risk. +.host.foo.com TRUE / FALSE 1896263787 injected yes .foo.com TRUE / FALSE 1993463787 test1 overwritten1 .host.foo.com TRUE / FALSE 1896263787 test2 two .foo.com TRUE / FALSE 1896263787 test3 three diff --git a/tests/libtest/lib506.c b/tests/libtest/lib506.c index 4477eaa50..bddda128c 100644 --- a/tests/libtest/lib506.c +++ b/tests/libtest/lib506.c @@ -202,6 +202,32 @@ int test(char *URL) return TEST_ERR_MAJOR_BAD; } + /* initial cookie manipulation */ + if ((curl = curl_easy_init()) == NULL) { + fprintf(stderr, "curl_easy_init() failed\n"); + curl_share_cleanup(share); + curl_global_cleanup(); + return TEST_ERR_MAJOR_BAD; + } + printf( "CURLOPT_SHARE\n" ); + test_setopt( curl, CURLOPT_SHARE, share ); + printf( "CURLOPT_COOKIELIST injected_and_clobbered\n" ); + test_setopt( curl, CURLOPT_COOKIELIST, + "Set-Cookie: injected_and_clobbered=yes; " + "domain=host.foo.com; expires=Sat Feb 2 11:56:27 GMT 2030" ); + printf( "CURLOPT_COOKIELIST ALL\n" ); + test_setopt( curl, CURLOPT_COOKIELIST, "ALL" ); + printf( "CURLOPT_COOKIELIST session\n" ); + test_setopt( curl, CURLOPT_COOKIELIST, "Set-Cookie: session=elephants" ); + printf( "CURLOPT_COOKIELIST injected\n" ); + test_setopt( curl, CURLOPT_COOKIELIST, + "Set-Cookie: injected=yes; domain=host.foo.com; " + "expires=Sat Feb 2 11:56:27 GMT 2030" ); + printf( "CURLOPT_COOKIELIST SESS\n" ); + test_setopt( curl, CURLOPT_COOKIELIST, "SESS" ); + printf( "CLEANUP\n" ); + curl_easy_cleanup( curl ); + res = 0; @@ -238,6 +264,8 @@ int test(char *URL) test_setopt( curl, CURLOPT_SHARE, share ); printf( "CURLOPT_COOKIEJAR\n" ); test_setopt( curl, CURLOPT_COOKIEJAR, JAR ); + printf( "CURLOPT_COOKIELIST FLUSH\n" ); + test_setopt( curl, CURLOPT_COOKIELIST, "FLUSH" ); printf( "PERFORM\n" ); curl_easy_perform( curl ); |