diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/data/test506 | 40 | ||||
| -rw-r--r-- | tests/libtest/lib506.c | 50 | 
2 files changed, 82 insertions, 8 deletions
diff --git a/tests/data/test506 b/tests/data/test506 index f53a68040..07bbdeaf3 100644 --- a/tests/data/test506 +++ b/tests/data/test506 @@ -169,18 +169,42 @@ unlock: cookie [Pigs in space]: 63  run 3: overwrite cookie 1 and 4  lock:   dns    [Pigs in space]: 64  unlock: dns    [Pigs in space]: 65 -try SHARE_CLEANUP... -lock:   share  [Pigs in space]: 66 -unlock: share  [Pigs in space]: 67 -SHARE_CLEANUP failed, correct  CLEANUP -lock:   cookie [Pigs in space]: 68 -unlock: cookie [Pigs in space]: 69 +lock:   cookie [Pigs in space]: 66 +unlock: cookie [Pigs in space]: 67 +lock:   share  [Pigs in space]: 68 +unlock: share  [Pigs in space]: 69 +CURLOPT_SHARE  lock:   share  [Pigs in space]: 70  unlock: share  [Pigs in space]: 71 +CURLOPT_COOKIELIST ALL +lock:   cookie [Pigs in space]: 72 +unlock: cookie [Pigs in space]: 73 +CURLOPT_COOKIEJAR +CURLOPT_COOKIELIST RELOAD +lock:   cookie [Pigs in space]: 74 +unlock: cookie [Pigs in space]: 75 +loaded cookies: +----------------- +  .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 +  .host.foo.com	TRUE	/	FALSE	2061978987	test4	overwritten4 +  .host.foo.com	TRUE	/	FALSE	1896263787	test5	five +----------------- +try SHARE_CLEANUP... +lock:   share  [Pigs in space]: 76 +unlock: share  [Pigs in space]: 77 +SHARE_CLEANUP failed, correct +CLEANUP +lock:   cookie [Pigs in space]: 78 +unlock: cookie [Pigs in space]: 79 +lock:   share  [Pigs in space]: 80 +unlock: share  [Pigs in space]: 81  SHARE_CLEANUP -lock:   share  [Pigs in space]: 72 -unlock: share  [Pigs in space]: 73 +lock:   share  [Pigs in space]: 82 +unlock: share  [Pigs in space]: 83  GLOBAL_CLEANUP  </stdout>  <stderr> diff --git a/tests/libtest/lib506.c b/tests/libtest/lib506.c index 4a3ec5aed..9bb4ff27e 100644 --- a/tests/libtest/lib506.c +++ b/tests/libtest/lib506.c @@ -175,11 +175,13 @@ int test(char *URL)  {    int res;    CURLSHcode scode = CURLSHE_OK; +  CURLcode code = CURLE_OK;    char *url = NULL;    struct Tdata tdata;    CURL *curl;    CURLSH *share;    struct curl_slist *headers = NULL; +  struct curl_slist *cookies = NULL;    int i;    struct userdata user; @@ -296,6 +298,54 @@ int test(char *URL)    printf( "PERFORM\n" );    curl_easy_perform( curl ); +  printf( "CLEANUP\n" ); +  curl_easy_cleanup( curl ); + +  /* load cookies */ +  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; +  } +  url = suburl( URL, i ); +  headers = sethost( NULL ); +  test_setopt( curl, CURLOPT_HTTPHEADER, headers ); +  test_setopt( curl, CURLOPT_URL,        url ); +  printf( "CURLOPT_SHARE\n" ); +  test_setopt( curl, CURLOPT_SHARE,      share ); +  printf( "CURLOPT_COOKIELIST ALL\n" ); +  test_setopt( curl, CURLOPT_COOKIELIST, "ALL" ); +  printf( "CURLOPT_COOKIEJAR\n" ); +  test_setopt( curl, CURLOPT_COOKIEFILE, JAR ); +  printf( "CURLOPT_COOKIELIST RELOAD\n" ); +  test_setopt( curl, CURLOPT_COOKIELIST, "RELOAD" ); + +  code = curl_easy_getinfo(curl, CURLINFO_COOKIELIST, &cookies); +  if ( code != CURLE_OK ) +  { +    fprintf(stderr, "curl_easy_getinfo() failed\n"); +    curl_share_cleanup(share); +    curl_global_cleanup(); +    return TEST_ERR_MAJOR_BAD; +  } +  printf("loaded cookies:\n"); +  if ( !cookies ) +  { +    fprintf(stderr, "  reloading cookies from '%s' failed\n", JAR); +    curl_share_cleanup(share); +    curl_global_cleanup(); +    return TEST_ERR_MAJOR_BAD; +  } +  printf("-----------------\n"); +  while ( cookies ) +  { +    printf( "  %s\n", cookies->data ); +    cookies = cookies->next; +  } +  printf("-----------------\n"); +  curl_slist_free_all( cookies ); +    /* try to free share, expect to fail because share is in use*/    printf( "try SHARE_CLEANUP...\n" );    scode = curl_share_cleanup( share );  | 
