0e2f3df1031aa462e5e4d6da7f21a99231817a59
[platform/upstream/curl.git] / tests / libtest / lib511.c
1 /*****************************************************************************
2  *                                  _   _ ____  _
3  *  Project                     ___| | | |  _ \| |
4  *                             / __| | | | |_) | |
5  *                            | (__| |_| |  _ <| |___
6  *                             \___|\___/|_| \_\_____|
7  *
8  * $Id$
9  */
10
11 #include "test.h"
12
13 #include "memdebug.h"
14
15 int test(char *URL)
16 {
17   CURLcode res;
18   CURL *curl;
19
20   if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
21     fprintf(stderr, "curl_global_init() failed\n");
22     return TEST_ERR_MAJOR_BAD;
23   }
24
25   if ((curl = curl_easy_init()) == NULL) {
26     fprintf(stderr, "curl_easy_init() failed\n");
27     curl_global_cleanup();
28     return TEST_ERR_MAJOR_BAD;
29   }
30
31   test_setopt(curl, CURLOPT_URL, URL);
32   test_setopt(curl, CURLOPT_FILETIME, 1L);
33   test_setopt(curl, CURLOPT_NOBODY, 1L);
34   test_setopt(curl, CURLOPT_VERBOSE, 1L);
35
36   res = curl_easy_perform(curl);
37
38 test_cleanup:
39
40   curl_easy_cleanup(curl);
41   curl_global_cleanup();
42
43   return (int)res;
44 }