lib583.c
Go to the documentation of this file.
1 /***************************************************************************
2  * _ _ ____ _
3  * Project ___| | | | _ \| |
4  * / __| | | | |_) | |
5  * | (__| |_| | _ <| |___
6  * \___|\___/|_| \_\_____|
7  *
8  * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
9  *
10  * This software is licensed as described in the file COPYING, which
11  * you should have received as part of this distribution. The terms
12  * are also available at https://curl.haxx.se/docs/copyright.html.
13  *
14  * You may opt to use, copy, modify, merge, publish, distribute and/or sell
15  * copies of the Software, and permit persons to whom the Software is
16  * furnished to do so, under the terms of the COPYING file.
17  *
18  * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19  * KIND, either express or implied.
20  *
21  ***************************************************************************/
22 /*
23  * This test case is based on the sample code provided by Saqib Ali
24  * https://curl.haxx.se/mail/lib-2011-03/0066.html
25  */
26 
27 #include "test.h"
28 
29 #include <sys/stat.h>
30 
31 #include "memdebug.h"
32 
33 int test(char *URL)
34 {
35  int stillRunning;
36  CURLM *multiHandle = NULL;
37  CURL *curl = NULL;
39 
41 
42  multi_init(multiHandle);
43 
44  easy_init(curl);
45 
46  easy_setopt(curl, CURLOPT_USERPWD, libtest_arg2);
47  easy_setopt(curl, CURLOPT_SSH_PUBLIC_KEYFILE, "curl_client_key.pub");
48  easy_setopt(curl, CURLOPT_SSH_PRIVATE_KEYFILE, "curl_client_key");
49 
50  easy_setopt(curl, CURLOPT_UPLOAD, 1L);
51  easy_setopt(curl, CURLOPT_VERBOSE, 1L);
52 
53  easy_setopt(curl, CURLOPT_URL, URL);
54  easy_setopt(curl, CURLOPT_INFILESIZE, (long)5);
55 
56  multi_add_handle(multiHandle, curl);
57 
58  /* this tests if removing an easy handle immediately after multi
59  perform has been called succeeds or not. */
60 
61  fprintf(stderr, "curl_multi_perform()...\n");
62 
63  multi_perform(multiHandle, &stillRunning);
64 
65  fprintf(stderr, "curl_multi_perform() succeeded\n");
66 
67  fprintf(stderr, "curl_multi_remove_handle()...\n");
68  res = curl_multi_remove_handle(multiHandle, curl);
69  if(res)
70  fprintf(stderr, "curl_multi_remove_handle() failed, "
71  "with code %d\n", (int)res);
72  else
73  fprintf(stderr, "curl_multi_remove_handle() succeeded\n");
74 
75 test_cleanup:
76 
77  /* undocumented cleanup sequence - type UB */
78 
79  curl_easy_cleanup(curl);
80  curl_multi_cleanup(multiHandle);
82 
83  return (int)res;
84 }
int test(char *URL)
Definition: lib583.c:33
#define global_init(A)
Definition: test.h:431
#define easy_setopt(A, B, C)
Definition: test.h:190
#define multi_add_handle(A, B)
Definition: test.h:238
static int res
char * libtest_arg2
Definition: first.c:75
#define easy_init(A)
Definition: test.h:145
CURL_EXTERN void curl_easy_cleanup(CURL *curl)
#define multi_perform(A, B)
Definition: test.h:293
CURL_EXTERN CURLMcode curl_multi_remove_handle(CURLM *multi_handle, CURL *curl_handle)
#define multi_init(A)
Definition: test.h:166
CURLMcode
Definition: multi.h:61
void CURLM
Definition: multi.h:58
void CURL
Definition: curl.h:102
Definition: multi.h:64
#define fprintf
Definition: curl_printf.h:41
CURL_EXTERN void curl_global_cleanup(void)
curl_global_cleanup() globally cleanups curl, uses the value of "init_flags" to determine what needs ...
Definition: easy.c:312
#define CURL_GLOBAL_ALL
Definition: curl.h:2519
static CURL * curl
Definition: sessioninfo.c:35
CURL_EXTERN CURLMcode curl_multi_cleanup(CURLM *multi_handle)


rc_tagdetect_client
Author(s): Monika Florek-Jasinska , Raphael Schaller
autogenerated on Sat Feb 13 2021 03:42:15