lib503.c
Go to the documentation of this file.
00001 /***************************************************************************
00002  *                                  _   _ ____  _
00003  *  Project                     ___| | | |  _ \| |
00004  *                             / __| | | | |_) | |
00005  *                            | (__| |_| |  _ <| |___
00006  *                             \___|\___/|_| \_\_____|
00007  *
00008  * Copyright (C) 1998 - 2012, 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 "testutil.h"
00025 #include "warnless.h"
00026 #include "memdebug.h"
00027 
00028 #define TEST_HANG_TIMEOUT 60 * 1000
00029 
00030 /*
00031  * Source code in here hugely as reported in bug report 651460 by
00032  * Christopher R. Palmer.
00033  *
00034  * Use multi interface to get HTTPS document over proxy, and provide
00035  * auth info.
00036  */
00037 
00038 int test(char *URL)
00039 {
00040   CURL *c = NULL;
00041   CURLM *m = NULL;
00042   int res = 0;
00043   int running;
00044 
00045   start_test_timing();
00046 
00047   global_init(CURL_GLOBAL_ALL);
00048 
00049   easy_init(c);
00050 
00051   easy_setopt(c, CURLOPT_PROXY, libtest_arg2); /* set in first.c */
00052   easy_setopt(c, CURLOPT_URL, URL);
00053   easy_setopt(c, CURLOPT_USERPWD, "test:ing");
00054   easy_setopt(c, CURLOPT_PROXYUSERPWD, "test:ing");
00055   easy_setopt(c, CURLOPT_HTTPPROXYTUNNEL, 1L);
00056   easy_setopt(c, CURLOPT_HEADER, 1L);
00057   easy_setopt(c, CURLOPT_VERBOSE, 1L);
00058 
00059   multi_init(m);
00060 
00061   multi_add_handle(m, c);
00062 
00063   for(;;) {
00064     struct timeval interval;
00065     fd_set rd, wr, exc;
00066     int maxfd = -99;
00067 
00068     interval.tv_sec = 1;
00069     interval.tv_usec = 0;
00070 
00071     multi_perform(m, &running);
00072 
00073     abort_on_test_timeout();
00074 
00075     if(!running)
00076       break; /* done */
00077 
00078     FD_ZERO(&rd);
00079     FD_ZERO(&wr);
00080     FD_ZERO(&exc);
00081 
00082     multi_fdset(m, &rd, &wr, &exc, &maxfd);
00083 
00084     /* At this point, maxfd is guaranteed to be greater or equal than -1. */
00085 
00086     select_test(maxfd+1, &rd, &wr, &exc, &interval);
00087 
00088     abort_on_test_timeout();
00089   }
00090 
00091 test_cleanup:
00092 
00093   /* proper cleanup sequence - type PA */
00094 
00095   curl_multi_remove_handle(m, c);
00096   curl_multi_cleanup(m);
00097   curl_easy_cleanup(c);
00098   curl_global_cleanup();
00099 
00100   return res;
00101 }
00102 


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