Resync
[CMakeLuaTailorHgBridge.git] / CMakeLua / Utilities / cmcurl-7.19.0 / docs / examples / https.c
blob70972c670ded209bc3db9a98fac370632f323a17
1 /*****************************************************************************
2 * _ _ ____ _
3 * Project ___| | | | _ \| |
4 * / __| | | | |_) | |
5 * | (__| |_| | _ <| |___
6 * \___|\___/|_| \_\_____|
8 * $Id: https.c,v 1.1.1.1 2008-09-23 16:32:05 hoffman Exp $
9 */
11 #include <stdio.h>
12 #include <curl/curl.h>
14 int main(void)
16 CURL *curl;
17 CURLcode res;
19 curl = curl_easy_init();
20 if(curl) {
21 curl_easy_setopt(curl, CURLOPT_URL, "https://sourceforge.net/");
23 #ifdef SKIP_PEER_VERIFICATION
25 * If you want to connect to a site who isn't using a certificate that is
26 * signed by one of the certs in the CA bundle you have, you can skip the
27 * verification of the server's certificate. This makes the connection
28 * A LOT LESS SECURE.
30 * If you have a CA cert for the server stored someplace else than in the
31 * default bundle, then the CURLOPT_CAPATH option might come handy for
32 * you.
34 curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
35 #endif
37 #ifdef SKIP_HOSTNAME_VERFICATION
39 * If the site you're connecting to uses a different host name that what
40 * they have mentioned in their server certificate's commonName (or
41 * subjectAltName) fields, libcurl will refuse to connect. You can skip
42 * this check, but this will make the connection less secure.
44 curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L);
45 #endif
47 res = curl_easy_perform(curl);
49 /* always cleanup */
50 curl_easy_cleanup(curl);
52 return 0;