1.1 --- a/extensions/curl/curl-src/docs/examples/https.c Sun Mar 17 22:05:33 2013 +0000
1.2 +++ b/extensions/curl/curl-src/docs/examples/https.c Sun Mar 17 22:23:20 2013 +0000
1.3 @@ -1,13 +1,24 @@
1.4 -/*****************************************************************************
1.5 +/***************************************************************************
1.6 * _ _ ____ _
1.7 * Project ___| | | | _ \| |
1.8 * / __| | | | |_) | |
1.9 * | (__| |_| | _ <| |___
1.10 * \___|\___/|_| \_\_____|
1.11 *
1.12 - * $Id: https.c,v 1.4 2008-05-22 21:20:09 danf Exp $
1.13 - */
1.14 -
1.15 + * Copyright (C) 1998 - 2012, Daniel Stenberg, <[email protected]>, et al.
1.16 + *
1.17 + * This software is licensed as described in the file COPYING, which
1.18 + * you should have received as part of this distribution. The terms
1.19 + * are also available at http://curl.haxx.se/docs/copyright.html.
1.20 + *
1.21 + * You may opt to use, copy, modify, merge, publish, distribute and/or sell
1.22 + * copies of the Software, and permit persons to whom the Software is
1.23 + * furnished to do so, under the terms of the COPYING file.
1.24 + *
1.25 + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
1.26 + * KIND, either express or implied.
1.27 + *
1.28 + ***************************************************************************/
1.29 #include <stdio.h>
1.30 #include <curl/curl.h>
1.31
1.32 @@ -16,9 +27,11 @@
1.33 CURL *curl;
1.34 CURLcode res;
1.35
1.36 + curl_global_init(CURL_GLOBAL_DEFAULT);
1.37 +
1.38 curl = curl_easy_init();
1.39 if(curl) {
1.40 - curl_easy_setopt(curl, CURLOPT_URL, "https://sourceforge.net/");
1.41 + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
1.42
1.43 #ifdef SKIP_PEER_VERIFICATION
1.44 /*
1.45 @@ -34,7 +47,7 @@
1.46 curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
1.47 #endif
1.48
1.49 -#ifdef SKIP_HOSTNAME_VERFICATION
1.50 +#ifdef SKIP_HOSTNAME_VERIFICATION
1.51 /*
1.52 * If the site you're connecting to uses a different host name that what
1.53 * they have mentioned in their server certificate's commonName (or
1.54 @@ -44,10 +57,18 @@
1.55 curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L);
1.56 #endif
1.57
1.58 + /* Perform the request, res will get the return code */
1.59 res = curl_easy_perform(curl);
1.60 + /* Check for errors */
1.61 + if(res != CURLE_OK)
1.62 + fprintf(stderr, "curl_easy_perform() failed: %s\n",
1.63 + curl_easy_strerror(res));
1.64
1.65 /* always cleanup */
1.66 curl_easy_cleanup(curl);
1.67 }
1.68 +
1.69 + curl_global_cleanup();
1.70 +
1.71 return 0;
1.72 }