lib512.c
Go to the documentation of this file.
00001 /***************************************************************************
00002  *                                  _   _ ____  _
00003  *  Project                     ___| | | |  _ \| |
00004  *                             / __| | | | |_) | |
00005  *                            | (__| |_| |  _ <| |___
00006  *                             \___|\___/|_| \_\_____|
00007  *
00008  * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
00009  *
00010  * This software is licensed as described in the file COPYING, which
00011  * you should have received as part of this distribution. The terms
00012  * are also available at https://curl.haxx.se/docs/copyright.html.
00013  *
00014  * You may opt to use, copy, modify, merge, publish, distribute and/or sell
00015  * copies of the Software, and permit persons to whom the Software is
00016  * furnished to do so, under the terms of the COPYING file.
00017  *
00018  * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
00019  * KIND, either express or implied.
00020  *
00021  ***************************************************************************/
00022 #include "test.h"
00023 
00024 #include "memdebug.h"
00025 
00026 /* Test case code based on source in a bug report filed by James Bursa on
00027    28 Apr 2004 */
00028 
00029 int test(char *URL)
00030 {
00031   CURLcode code;
00032   CURL *curl;
00033   CURL *curl2;
00034   int rc = 99;
00035 
00036   code = curl_global_init(CURL_GLOBAL_ALL);
00037   if(code == CURLE_OK) {
00038 
00039     curl = curl_easy_init();
00040     if(curl) {
00041 
00042       curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
00043       curl_easy_setopt(curl, CURLOPT_HEADER, 1L);
00044 
00045       curl2 = curl_easy_duphandle(curl);
00046       if(curl2) {
00047 
00048         code = curl_easy_setopt(curl2, CURLOPT_URL, URL);
00049         if(code == CURLE_OK) {
00050 
00051           code = curl_easy_perform(curl2);
00052           if(code == CURLE_OK)
00053             rc = 0;
00054           else
00055             rc = 1;
00056         }
00057         else
00058           rc = 2;
00059 
00060         curl_easy_cleanup(curl2);
00061       }
00062       else
00063         rc = 3;
00064 
00065       curl_easy_cleanup(curl);
00066     }
00067     else
00068       rc = 4;
00069 
00070     curl_global_cleanup();
00071   }
00072   else
00073     rc = 5;
00074 
00075   return rc;
00076 }
00077 


rc_visard_driver
Author(s): Heiko Hirschmueller , Christian Emmerich , Felix Ruess
autogenerated on Thu Jun 6 2019 20:43:05