lib583.c
Go to the documentation of this file.
00001 /***************************************************************************
00002  *                                  _   _ ____  _
00003  *  Project                     ___| | | |  _ \| |
00004  *                             / __| | | | |_) | |
00005  *                            | (__| |_| |  _ <| |___
00006  *                             \___|\___/|_| \_\_____|
00007  *
00008  * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
00009  *
00010  * This software is licensed as described in the file COPYING, which
00011  * you should have received as part of this distribution. The terms
00012  * are also available at https://curl.haxx.se/docs/copyright.html.
00013  *
00014  * You may opt to use, copy, modify, merge, publish, distribute and/or sell
00015  * copies of the Software, and permit persons to whom the Software is
00016  * furnished to do so, under the terms of the COPYING file.
00017  *
00018  * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
00019  * KIND, either express or implied.
00020  *
00021  ***************************************************************************/
00022 /*
00023  * This test case is based on the sample code provided by Saqib Ali
00024  * https://curl.haxx.se/mail/lib-2011-03/0066.html
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   /* this tests if removing an easy handle immediately after multi
00059      perform has been called succeeds or not. */
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   /* undocumented cleanup sequence - type UB */
00078 
00079   curl_easy_cleanup(curl);
00080   curl_multi_cleanup(multiHandle);
00081   curl_global_cleanup();
00082 
00083   return res;
00084 }


rc_visard_driver
Author(s): Heiko Hirschmueller , Christian Emmerich , Felix Ruess
autogenerated on Thu Jun 6 2019 20:43:05