#include <stdio.h>
#include <stdlib.h>
#include <curl/curl.h>

static const char *certfile = "/usr/local/share/certs/ca-root-nss.crt";

static const char *url[] = {
        "https://google.ca/",     "https://google.co.uk/",
        "https://google.com.au/", "https://google.com.mx/",
        "https://google.com/",    "https://google.de/",
        "https://google.dk/"
};

#define urls (sizeof(url)/sizeof(url[0]))

int main(void) {
        CURL *curl;
        CURLcode res;
        int i = 0;

        curl = curl_easy_init();
        if (!curl)
                return(1);
        while (++i) {
                printf("--- %d. ", i);
                curl_easy_setopt(curl, CURLOPT_URL, url[i % urls]);
                curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
                curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L);
                if (i % 2 == 0) {
                        printf("cainfo ");
                        curl_easy_setopt(curl, CURLOPT_CAINFO, certfile);
                }
                else {
                        printf("request ");
                        curl_easy_setopt(curl, CURLOPT_CAINFO, NULL);
                }
                printf("%s ---\n", url[i % urls]);
                res = curl_easy_perform(curl);
                printf("--- result %d - %s ---\n", (int) res,
                       curl_easy_strerror(res));
        }
        curl_easy_cleanup(curl);
        return(0);
}

