Resync
[CMakeLuaTailorHgBridge.git] / CMakeLua / Utilities / cmcurl-7.19.0 / tests / libtest / lib542.c
blobbc24fea66c31a29a90ac84a110dd0e9e4f38af6f
1 /*****************************************************************************
2 * _ _ ____ _
3 * Project ___| | | | _ \| |
4 * / __| | | | |_) | |
5 * | (__| |_| | _ <| |___
6 * \___|\___/|_| \_\_____|
8 * $Id: lib542.c,v 1.1.1.1 2008-09-23 16:32:06 hoffman Exp $
9 */
11 #include "setup.h" /* struct_stat etc. */
12 #include "test.h"
14 #ifdef HAVE_SYS_SOCKET_H
15 #include <sys/socket.h>
16 #endif
17 #ifdef HAVE_SYS_TYPES_H
18 #include <sys/types.h>
19 #endif
20 #ifdef HAVE_SYS_STAT_H
21 #include <sys/stat.h>
22 #endif
23 #ifdef HAVE_FCNTL_H
24 #include <fcntl.h>
25 #endif
27 #ifdef HAVE_UNISTD_H
28 #include <unistd.h>
29 #endif
32 * FTP get with NOBODY but no HEADER
35 int test(char *URL)
37 CURL *curl;
38 CURLcode res = CURLE_OK;
40 if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
41 fprintf(stderr, "curl_global_init() failed\n");
42 return TEST_ERR_MAJOR_BAD;
45 /* get a curl handle */
46 if ((curl = curl_easy_init()) == NULL) {
47 fprintf(stderr, "curl_easy_init() failed\n");
48 curl_global_cleanup();
49 return TEST_ERR_MAJOR_BAD;
52 /* enable verbose */
53 curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
55 /* enable NOBODY */
56 curl_easy_setopt(curl, CURLOPT_NOBODY, 1L);
58 /* disable HEADER */
59 curl_easy_setopt(curl, CURLOPT_HEADER, 0L);
61 /* specify target */
62 curl_easy_setopt(curl,CURLOPT_URL, URL);
64 /* Now run off and do what you've been told! */
65 res = curl_easy_perform(curl);
67 curl_easy_cleanup(curl);
68 curl_global_cleanup();
70 return res;