Resync
[CMakeLuaTailorHgBridge.git] / CMakeLua / Utilities / cmcurl-7.19.0 / tests / libtest / lib516.c
blob3caef41faa7afc3ea49c9322ca053becf4769efe
1 /*****************************************************************************
2 * _ _ ____ _
3 * Project ___| | | | _ \| |
4 * / __| | | | |_) | |
5 * | (__| |_| | _ <| |___
6 * \___|\___/|_| \_\_____|
8 * $Id: lib516.c,v 1.1.1.1 2008-09-23 16:32:06 hoffman Exp $
9 */
11 #include "test.h"
13 int test(char *URL)
15 CURL *curl;
16 CURLcode res=CURLE_OK;
18 if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
19 fprintf(stderr, "curl_global_init() failed\n");
20 return TEST_ERR_MAJOR_BAD;
23 if ((curl = curl_easy_init()) == NULL) {
24 fprintf(stderr, "curl_easy_init() failed\n");
25 curl_global_cleanup();
26 return TEST_ERR_MAJOR_BAD;
29 /* First set the URL that is about to receive our POST. */
30 curl_easy_setopt(curl, CURLOPT_URL, URL);
31 curl_easy_setopt(curl, CURLOPT_HTTPPOST, NULL);
32 curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); /* show verbose for debug */
33 curl_easy_setopt(curl, CURLOPT_HEADER, 1L); /* include header */
35 /* Now, we should be making a zero byte POST request */
36 res = curl_easy_perform(curl);
38 /* always cleanup */
39 curl_easy_cleanup(curl);
40 curl_global_cleanup();
42 return (int)res;