Git init
[external/curl.git] / tests / libtest / lib549.c
1 /*****************************************************************************
2  *                                  _   _ ____  _
3  *  Project                     ___| | | |  _ \| |
4  *                             / __| | | | |_) | |
5  *                            | (__| |_| |  _ <| |___
6  *                             \___|\___/|_| \_\_____|
7  *
8  *
9  * argv1 = URL
10  * argv2 = proxy
11  * argv3 = non-zero means ASCII transfer
12  */
13
14 #include "test.h"
15
16 #include "memdebug.h"
17
18 int test(char *URL)
19 {
20   CURLcode res;
21   CURL *curl;
22
23   if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
24     fprintf(stderr, "curl_global_init() failed\n");
25     return TEST_ERR_MAJOR_BAD;
26   }
27
28   if ((curl = curl_easy_init()) == NULL) {
29     fprintf(stderr, "curl_easy_init() failed\n");
30     curl_global_cleanup();
31     return TEST_ERR_MAJOR_BAD;
32   }
33
34   test_setopt(curl, CURLOPT_PROXY, libtest_arg2);
35   test_setopt(curl, CURLOPT_URL, URL);
36   test_setopt(curl, CURLOPT_PROXY_TRANSFER_MODE, 1L);
37   test_setopt(curl, CURLOPT_VERBOSE, 1L);
38   if(libtest_arg3) {
39     /* enable ascii/text mode */
40     test_setopt(curl, CURLOPT_TRANSFERTEXT, 1L);
41   }
42
43   res = curl_easy_perform(curl);
44
45 test_cleanup:
46
47   curl_easy_cleanup(curl);
48   curl_global_cleanup();
49
50   return (int)res;
51 }
52