Resync
[CMakeLuaTailorHgBridge.git] / CMakeLua / Utilities / cmcurl-7.19.0 / tests / libtest / lib512.c
blob11388ae6047cdec32c9413a48aa72080a03ba526
1 /*****************************************************************************
2 * _ _ ____ _
3 * Project ___| | | | _ \| |
4 * / __| | | | |_) | |
5 * | (__| |_| | _ <| |___
6 * \___|\___/|_| \_\_____|
8 * $Id: lib512.c,v 1.1.1.1 2008-09-23 16:32:06 hoffman Exp $
9 */
11 #include "test.h"
13 /* Test case code based on source in a bug report filed by James Bursa on
14 28 Apr 2004 */
16 int test(char *URL)
18 CURLcode code;
19 CURL *curl;
20 CURL *curl2;
21 int rc = 99;
23 code = curl_global_init(CURL_GLOBAL_ALL);
24 if(code == CURLE_OK) {
26 curl = curl_easy_init();
27 if(curl) {
29 curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
30 curl_easy_setopt(curl, CURLOPT_HEADER, 1L);
32 curl2 = curl_easy_duphandle(curl);
33 if(curl2) {
35 code = curl_easy_setopt(curl2, CURLOPT_URL, URL);
36 if(code == CURLE_OK) {
38 code = curl_easy_perform(curl2);
39 if(code == CURLE_OK)
40 rc = 0;
41 else
42 rc = 1;
44 else
45 rc = 2;
47 curl_easy_cleanup(curl2);
49 else
50 rc = 3;
52 curl_easy_cleanup(curl);
54 else
55 rc = 4;
57 curl_global_cleanup();
59 else
60 rc = 5;
62 return rc;