lib564.c
Go to the documentation of this file.
00001 /***************************************************************************
00002  *                                  _   _ ____  _
00003  *  Project                     ___| | | |  _ \| |
00004  *                             / __| | | | |_) | |
00005  *                            | (__| |_| |  _ <| |___
00006  *                             \___|\___/|_| \_\_____|
00007  *
00008  * Copyright (C) 1998 - 2013, 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 #include "test.h"
00023 
00024 #include <fcntl.h>
00025 
00026 #include "testutil.h"
00027 #include "warnless.h"
00028 #include "memdebug.h"
00029 
00030 #define TEST_HANG_TIMEOUT 60 * 1000
00031 
00032 int test(char *URL)
00033 {
00034   int res = 0;
00035   CURL *curl = NULL;
00036   int running;
00037   CURLM *m = NULL;
00038 
00039   start_test_timing();
00040 
00041   global_init(CURL_GLOBAL_ALL);
00042 
00043   easy_init(curl);
00044 
00045   easy_setopt(curl, CURLOPT_URL, URL);
00046   easy_setopt(curl, CURLOPT_VERBOSE, 1L);
00047   easy_setopt(curl, CURLOPT_PROXY, libtest_arg2);
00048   easy_setopt(curl, CURLOPT_PROXYTYPE, (long)CURLPROXY_SOCKS4);
00049 
00050   multi_init(m);
00051 
00052   multi_add_handle(m, curl);
00053 
00054   fprintf(stderr, "Start at URL 0\n");
00055 
00056   for(;;) {
00057     struct timeval interval;
00058     fd_set rd, wr, exc;
00059     int maxfd = -99;
00060 
00061     interval.tv_sec = 1;
00062     interval.tv_usec = 0;
00063 
00064     multi_perform(m, &running);
00065 
00066     abort_on_test_timeout();
00067 
00068     if(!running)
00069       break; /* done */
00070 
00071     FD_ZERO(&rd);
00072     FD_ZERO(&wr);
00073     FD_ZERO(&exc);
00074 
00075     multi_fdset(m, &rd, &wr, &exc, &maxfd);
00076 
00077     /* At this point, maxfd is guaranteed to be greater or equal than -1. */
00078 
00079     select_test(maxfd+1, &rd, &wr, &exc, &interval);
00080 
00081     abort_on_test_timeout();
00082   }
00083 
00084 test_cleanup:
00085 
00086   /* undocumented cleanup sequence - type UB */
00087 
00088   curl_easy_cleanup(curl);
00089   curl_multi_cleanup(m);
00090   curl_global_cleanup();
00091 
00092   return res;
00093 }


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