#include <curl/curl.h>

int main(int argc, char *argv[])
{
  CURLcode ret;
  CURL *hnd;
  struct curl_slist *slist1;
  struct curl_slist *slist2;

  slist1 = NULL;
  slist1 = curl_slist_append(slist1, "connection:close");
  slist2 = NULL;
  slist2 = curl_slist_append(slist2, "connection:close");

  hnd = curl_easy_init();
  curl_easy_setopt(hnd, CURLOPT_URL, "https://example.com/");
  curl_easy_setopt(hnd, CURLOPT_NOPROGRESS, 1L);
  curl_easy_setopt(hnd, CURLOPT_NOBODY, 1L);
  curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, slist1);
  curl_easy_setopt(hnd, CURLOPT_HTTP_VERSION, (long)CURL_HTTP_VERSION_1_1);
  curl_easy_setopt(hnd, CURLOPT_VERBOSE, 1L);

  ret = curl_easy_perform(hnd);
#ifdef RESET
  curl_easy_cleanup(hnd);
  hnd = curl_easy_init();
#endif

  curl_easy_setopt(hnd, CURLOPT_URL, "https://www.example.com/");
  curl_easy_setopt(hnd, CURLOPT_NOPROGRESS, 1L);
  curl_easy_setopt(hnd, CURLOPT_NOBODY, 1L);
  curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, slist2);
  curl_easy_setopt(hnd, CURLOPT_HTTP_VERSION, (long)CURL_HTTP_VERSION_1_1);
  curl_easy_setopt(hnd, CURLOPT_VERBOSE, 1L);

  ret = curl_easy_perform(hnd);
  curl_easy_cleanup(hnd);

  hnd = NULL;
  curl_slist_free_all(slist1);
  slist1 = NULL;
  curl_slist_free_all(slist2);
  slist2 = NULL;

  return (int)ret;
}

