]> rtime.felk.cvut.cz Git - hornmich/skoda-qr-demo.git/blob - QRScanner/mobile/jni/thirdparty/curl/tests/libtest/lib1510.c
Add MuPDF native source codes
[hornmich/skoda-qr-demo.git] / QRScanner / mobile / jni / thirdparty / curl / tests / libtest / lib1510.c
1 /***************************************************************************
2  *                                  _   _ ____  _
3  *  Project                     ___| | | |  _ \| |
4  *                             / __| | | | |_) | |
5  *                            | (__| |_| |  _ <| |___
6  *                             \___|\___/|_| \_\_____|
7  *
8  * Copyright (C) 2013, Linus Nielsen Feltzing <linus@haxx.se>
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 http://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 #include "test.h"
23
24 #include "testutil.h"
25 #include "warnless.h"
26 #include "memdebug.h"
27
28 #define TEST_HANG_TIMEOUT 60 * 1000
29
30 #define NUM_URLS 4
31
32 int test(char *URL)
33 {
34   int res = 0;
35   CURL *curl = NULL;
36   int i;
37   char target_url[256];
38   char dnsentry[256];
39   struct curl_slist *slist = NULL;
40   char *port = libtest_arg3;
41   char *address = libtest_arg2;
42
43   (void)URL;
44
45   /* Create fake DNS entries for serverX.example.com for all handles */
46   for(i=0; i < NUM_URLS; i++) {
47     sprintf(dnsentry, "server%d.example.com:%s:%s", i + 1, port, address);
48     printf("%s\n", dnsentry);
49     slist = curl_slist_append(slist, dnsentry);
50   }
51
52   start_test_timing();
53
54   global_init(CURL_GLOBAL_ALL);
55
56   /* get an easy handle */
57   easy_init(curl);
58
59   /* go verbose */
60   easy_setopt(curl, CURLOPT_VERBOSE, 1L);
61   /* include headers */
62   easy_setopt(curl, CURLOPT_HEADER, 1L);
63
64   easy_setopt(curl, CURLOPT_RESOLVE, slist);
65
66   easy_setopt(curl, CURLOPT_MAXCONNECTS, 3);
67
68   /* get NUM_HANDLES easy handles */
69   for(i=0; i < NUM_URLS; i++) {
70     /* specify target */
71     sprintf(target_url, "http://server%d.example.com:%s/path/1510%04i",
72             i + 1, port, i + 1);
73     target_url[sizeof(target_url) - 1] = '\0';
74     easy_setopt(curl, CURLOPT_URL, target_url);
75
76     res = curl_easy_perform(curl);
77
78     abort_on_test_timeout();
79   }
80
81 test_cleanup:
82
83   /* proper cleanup sequence - type PB */
84
85   curl_easy_cleanup(curl);
86
87   curl_slist_free_all(slist);
88
89   curl_global_cleanup();
90
91   return res;
92 }