mirror of
https://github.com/moparisthebest/curl
synced 2024-12-22 08:08:50 -05:00
modified and corrected test 506
This commit is contained in:
parent
d262d0a62a
commit
989ec98ebd
@ -63,73 +63,79 @@ CURL_LOCK_DATA_COOKIE
|
|||||||
CURL_LOCK_DATA_DNS
|
CURL_LOCK_DATA_DNS
|
||||||
*** run 1
|
*** run 1
|
||||||
CURLOPT_SHARE
|
CURLOPT_SHARE
|
||||||
lock: share <Pigs in space>
|
lock: share <Pigs in space>: 0
|
||||||
unlock: share <Pigs in space>
|
unlock: share <Pigs in space>: 1
|
||||||
PERFORM
|
PERFORM
|
||||||
lock: dns <Pigs in space>
|
lock: dns <Pigs in space>: 2
|
||||||
unlock: dns <Pigs in space>
|
unlock: dns <Pigs in space>: 3
|
||||||
lock: dns <Pigs in space>
|
lock: dns <Pigs in space>: 4
|
||||||
unlock: dns <Pigs in space>
|
unlock: dns <Pigs in space>: 5
|
||||||
lock: cookie <Pigs in space>
|
lock: cookie <Pigs in space>: 6
|
||||||
unlock: cookie <Pigs in space>
|
unlock: cookie <Pigs in space>: 7
|
||||||
lock: cookie <Pigs in space>
|
lock: cookie <Pigs in space>: 8
|
||||||
unlock: cookie <Pigs in space>
|
unlock: cookie <Pigs in space>: 9
|
||||||
lock: cookie <Pigs in space>
|
lock: cookie <Pigs in space>: 10
|
||||||
unlock: cookie <Pigs in space>
|
unlock: cookie <Pigs in space>: 11
|
||||||
lock: cookie <Pigs in space>
|
lock: cookie <Pigs in space>: 12
|
||||||
unlock: cookie <Pigs in space>
|
unlock: cookie <Pigs in space>: 13
|
||||||
run 1: set cookie 1, 2 and 3
|
run 1: set cookie 1, 2 and 3
|
||||||
lock: dns <Pigs in space>
|
lock: dns <Pigs in space>: 14
|
||||||
unlock: dns <Pigs in space>
|
unlock: dns <Pigs in space>: 15
|
||||||
|
lock: dns <Pigs in space>: 16
|
||||||
|
unlock: dns <Pigs in space>: 17
|
||||||
CLEANUP
|
CLEANUP
|
||||||
lock: cookie <Pigs in space>
|
lock: cookie <Pigs in space>: 18
|
||||||
unlock: cookie <Pigs in space>
|
unlock: cookie <Pigs in space>: 19
|
||||||
*** run 2
|
*** run 2
|
||||||
CURLOPT_SHARE
|
CURLOPT_SHARE
|
||||||
lock: share <Pigs in space>
|
lock: share <Pigs in space>: 20
|
||||||
unlock: share <Pigs in space>
|
unlock: share <Pigs in space>: 21
|
||||||
PERFORM
|
PERFORM
|
||||||
lock: dns <Pigs in space>
|
lock: dns <Pigs in space>: 22
|
||||||
unlock: dns <Pigs in space>
|
unlock: dns <Pigs in space>: 23
|
||||||
lock: cookie <Pigs in space>
|
lock: cookie <Pigs in space>: 24
|
||||||
unlock: cookie <Pigs in space>
|
unlock: cookie <Pigs in space>: 25
|
||||||
lock: cookie <Pigs in space>
|
lock: cookie <Pigs in space>: 26
|
||||||
unlock: cookie <Pigs in space>
|
unlock: cookie <Pigs in space>: 27
|
||||||
lock: cookie <Pigs in space>
|
lock: cookie <Pigs in space>: 28
|
||||||
unlock: cookie <Pigs in space>
|
unlock: cookie <Pigs in space>: 29
|
||||||
run 2: set cookie 4 and 5
|
run 2: set cookie 4 and 5
|
||||||
lock: dns <Pigs in space>
|
lock: dns <Pigs in space>: 30
|
||||||
unlock: dns <Pigs in space>
|
unlock: dns <Pigs in space>: 31
|
||||||
|
lock: dns <Pigs in space>: 32
|
||||||
|
unlock: dns <Pigs in space>: 33
|
||||||
CLEANUP
|
CLEANUP
|
||||||
lock: cookie <Pigs in space>
|
lock: cookie <Pigs in space>: 34
|
||||||
unlock: cookie <Pigs in space>
|
unlock: cookie <Pigs in space>: 35
|
||||||
*** run 3
|
*** run 3
|
||||||
CURLOPT_SHARE
|
CURLOPT_SHARE
|
||||||
lock: share <Pigs in space>
|
lock: share <Pigs in space>: 36
|
||||||
unlock: share <Pigs in space>
|
unlock: share <Pigs in space>: 37
|
||||||
CURLOPT_COOKIEJAR
|
CURLOPT_COOKIEJAR
|
||||||
PERFORM
|
PERFORM
|
||||||
lock: dns <Pigs in space>
|
lock: dns <Pigs in space>: 38
|
||||||
unlock: dns <Pigs in space>
|
unlock: dns <Pigs in space>: 39
|
||||||
lock: cookie <Pigs in space>
|
lock: cookie <Pigs in space>: 40
|
||||||
unlock: cookie <Pigs in space>
|
unlock: cookie <Pigs in space>: 41
|
||||||
lock: cookie <Pigs in space>
|
lock: cookie <Pigs in space>: 42
|
||||||
unlock: cookie <Pigs in space>
|
unlock: cookie <Pigs in space>: 43
|
||||||
lock: cookie <Pigs in space>
|
lock: cookie <Pigs in space>: 44
|
||||||
unlock: cookie <Pigs in space>
|
unlock: cookie <Pigs in space>: 45
|
||||||
run 3: overwrite cookie 1 and 4
|
run 3: overwrite cookie 1 and 4
|
||||||
lock: dns <Pigs in space>
|
lock: dns <Pigs in space>: 46
|
||||||
unlock: dns <Pigs in space>
|
unlock: dns <Pigs in space>: 47
|
||||||
|
lock: dns <Pigs in space>: 48
|
||||||
|
unlock: dns <Pigs in space>: 49
|
||||||
try SHARE_CLEANUP...
|
try SHARE_CLEANUP...
|
||||||
lock: share <Pigs in space>
|
lock: share <Pigs in space>: 50
|
||||||
unlock: share <Pigs in space>
|
unlock: share <Pigs in space>: 51
|
||||||
SHARE_CLEANUP failed, correct
|
SHARE_CLEANUP failed, correct
|
||||||
CLEANUP
|
CLEANUP
|
||||||
lock: cookie <Pigs in space>
|
lock: cookie <Pigs in space>: 52
|
||||||
unlock: cookie <Pigs in space>
|
unlock: cookie <Pigs in space>: 53
|
||||||
SHARE_CLEANUP
|
SHARE_CLEANUP
|
||||||
lock: share <Pigs in space>
|
lock: share <Pigs in space>: 54
|
||||||
unlock: share <Pigs in space>
|
unlock: share <Pigs in space>: 55
|
||||||
GLOBAL_CLEANUP
|
GLOBAL_CLEANUP
|
||||||
</stdout>
|
</stdout>
|
||||||
<stderr>
|
<stderr>
|
||||||
|
@ -14,14 +14,21 @@ struct Tdata {
|
|||||||
char *url;
|
char *url;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct userdata {
|
||||||
|
char *text;
|
||||||
|
int counter;
|
||||||
|
};
|
||||||
|
|
||||||
/* lock callback */
|
/* lock callback */
|
||||||
void lock(CURL *handle, curl_lock_data data, curl_lock_access access,
|
void lock(CURL *handle, curl_lock_data data, curl_lock_access access,
|
||||||
void *useptr )
|
void *useptr )
|
||||||
{
|
{
|
||||||
const char *what;
|
const char *what;
|
||||||
|
struct userdata *user = (struct userdata *)useptr;
|
||||||
|
|
||||||
(void)handle;
|
(void)handle;
|
||||||
(void)access;
|
(void)access;
|
||||||
|
|
||||||
switch ( data ) {
|
switch ( data ) {
|
||||||
case CURL_LOCK_DATA_SHARE:
|
case CURL_LOCK_DATA_SHARE:
|
||||||
what = "share";
|
what = "share";
|
||||||
@ -36,13 +43,15 @@ void lock(CURL *handle, curl_lock_data data, curl_lock_access access,
|
|||||||
fprintf(stderr, "lock: no such data: %d\n",data);
|
fprintf(stderr, "lock: no such data: %d\n",data);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
printf("lock: %s <%s>\n", what, (char *)useptr);
|
printf("lock: %-6s <%s>: %d\n", what, user->text, user->counter);
|
||||||
|
user->counter++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* unlock callback */
|
/* unlock callback */
|
||||||
void unlock(CURL *handle, curl_lock_data data, void *useptr )
|
void unlock(CURL *handle, curl_lock_data data, void *useptr )
|
||||||
{
|
{
|
||||||
const char *what;
|
const char *what;
|
||||||
|
struct userdata *user = (struct userdata *)useptr;
|
||||||
(void)handle;
|
(void)handle;
|
||||||
switch ( data ) {
|
switch ( data ) {
|
||||||
case CURL_LOCK_DATA_SHARE:
|
case CURL_LOCK_DATA_SHARE:
|
||||||
@ -58,7 +67,8 @@ void unlock(CURL *handle, curl_lock_data data, void *useptr )
|
|||||||
fprintf(stderr, "unlock: no such data: %d\n",data);
|
fprintf(stderr, "unlock: no such data: %d\n",data);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
printf("unlock: %s <%s>\n", what, (char *)useptr);
|
printf("unlock: %-6s <%s>: %d\n", what, user->text, user->counter);
|
||||||
|
user->counter++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -127,6 +137,10 @@ CURLcode test(char *URL)
|
|||||||
CURLSH *share;
|
CURLSH *share;
|
||||||
struct curl_slist *headers;
|
struct curl_slist *headers;
|
||||||
int i;
|
int i;
|
||||||
|
struct userdata user;
|
||||||
|
|
||||||
|
user.text = (char *)"Pigs in space";
|
||||||
|
user.counter = 0;
|
||||||
|
|
||||||
printf( "GLOBAL_INIT\n" );
|
printf( "GLOBAL_INIT\n" );
|
||||||
curl_global_init( CURL_GLOBAL_ALL );
|
curl_global_init( CURL_GLOBAL_ALL );
|
||||||
@ -136,7 +150,7 @@ CURLcode test(char *URL)
|
|||||||
share = curl_share_init();
|
share = curl_share_init();
|
||||||
curl_share_setopt( share, CURLSHOPT_LOCKFUNC, lock);
|
curl_share_setopt( share, CURLSHOPT_LOCKFUNC, lock);
|
||||||
curl_share_setopt( share, CURLSHOPT_UNLOCKFUNC, unlock);
|
curl_share_setopt( share, CURLSHOPT_UNLOCKFUNC, unlock);
|
||||||
curl_share_setopt( share, CURLSHOPT_USERDATA, "Pigs in space");
|
curl_share_setopt( share, CURLSHOPT_USERDATA, &user);
|
||||||
printf( "CURL_LOCK_DATA_COOKIE\n" );
|
printf( "CURL_LOCK_DATA_COOKIE\n" );
|
||||||
curl_share_setopt( share, CURLSHOPT_SHARE, CURL_LOCK_DATA_COOKIE);
|
curl_share_setopt( share, CURLSHOPT_SHARE, CURL_LOCK_DATA_COOKIE);
|
||||||
printf( "CURL_LOCK_DATA_DNS\n" );
|
printf( "CURL_LOCK_DATA_DNS\n" );
|
||||||
|
Loading…
Reference in New Issue
Block a user