Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #include "test.h"
00028
00029 #include <sys/stat.h>
00030
00031 #include "memdebug.h"
00032
00033 int test(char *URL)
00034 {
00035 int stillRunning;
00036 CURLM *multiHandle = NULL;
00037 CURL *curl = NULL;
00038 int res = 0;
00039
00040 global_init(CURL_GLOBAL_ALL);
00041
00042 multi_init(multiHandle);
00043
00044 easy_init(curl);
00045
00046 easy_setopt(curl, CURLOPT_USERPWD, libtest_arg2);
00047 easy_setopt(curl, CURLOPT_SSH_PUBLIC_KEYFILE, "curl_client_key.pub");
00048 easy_setopt(curl, CURLOPT_SSH_PRIVATE_KEYFILE, "curl_client_key");
00049
00050 easy_setopt(curl, CURLOPT_UPLOAD, 1L);
00051 easy_setopt(curl, CURLOPT_VERBOSE, 1L);
00052
00053 easy_setopt(curl, CURLOPT_URL, URL);
00054 easy_setopt(curl, CURLOPT_INFILESIZE, (long)5);
00055
00056 multi_add_handle(multiHandle, curl);
00057
00058
00059
00060
00061 fprintf(stderr, "curl_multi_perform()...\n");
00062
00063 multi_perform(multiHandle, &stillRunning);
00064
00065 fprintf(stderr, "curl_multi_perform() succeeded\n");
00066
00067 fprintf(stderr, "curl_multi_remove_handle()...\n");
00068 res = (int) curl_multi_remove_handle(multiHandle, curl);
00069 if(res)
00070 fprintf(stderr, "curl_multi_remove_handle() failed, "
00071 "with code %d\n", res);
00072 else
00073 fprintf(stderr, "curl_multi_remove_handle() succeeded\n");
00074
00075 test_cleanup:
00076
00077
00078
00079 curl_easy_cleanup(curl);
00080 curl_multi_cleanup(multiHandle);
00081 curl_global_cleanup();
00082
00083 return res;
00084 }