#include <curl/curl.h>

int dummy(CURL *ch, size_t n, size_t c, void *u)
{
	return n*c;
}

#define VERBOSE 1
#define URL "http://www.google.com/"

void init(CURL *ch, CURLSH *sh)
{
	curl_easy_setopt(ch, CURLOPT_PROGRESSFUNCTION, NULL);
	curl_easy_setopt(ch, CURLOPT_URL, NULL);
	curl_easy_setopt(ch, CURLOPT_NOPROGRESS, 1L);
	curl_easy_setopt(ch, CURLOPT_PROXY, NULL);
	curl_easy_setopt(ch, CURLOPT_PROXYPORT, 0L);
	curl_easy_setopt(ch, CURLOPT_PROXYTYPE, 0L);
	curl_easy_setopt(ch, CURLOPT_PROXYUSERPWD, NULL);
	curl_easy_setopt(ch, CURLOPT_PROXYAUTH, 0L);
	curl_easy_setopt(ch, CURLOPT_DNS_CACHE_TIMEOUT, 60L);
	curl_easy_setopt(ch, CURLOPT_IPRESOLVE, 0);
	curl_easy_setopt(ch, CURLOPT_LOW_SPEED_LIMIT, 0L);
	curl_easy_setopt(ch, CURLOPT_LOW_SPEED_TIME, 0L);
	curl_easy_setopt(ch, CURLOPT_MAX_SEND_SPEED_LARGE, (curl_off_t) 0);
	curl_easy_setopt(ch, CURLOPT_MAX_RECV_SPEED_LARGE, (curl_off_t) 0);
	curl_easy_setopt(ch, CURLOPT_FRESH_CONNECT, 0L);
	curl_easy_setopt(ch, CURLOPT_FORBID_REUSE, 0L);
	curl_easy_setopt(ch, CURLOPT_INTERFACE, NULL);
	curl_easy_setopt(ch, CURLOPT_PORT, 0L);
	curl_easy_setopt(ch, CURLOPT_LOCALPORT, 0L);
	curl_easy_setopt(ch, CURLOPT_LOCALPORTRANGE, 0L);
	curl_easy_setopt(ch, CURLOPT_USERPWD, NULL);
	curl_easy_setopt(ch, CURLOPT_HTTPAUTH, 0L);
	curl_easy_setopt(ch, CURLOPT_ENCODING, NULL);
	curl_easy_setopt(ch, CURLOPT_FOLLOWLOCATION, 0L);
	curl_easy_setopt(ch, CURLOPT_UNRESTRICTED_AUTH, 0L);
	curl_easy_setopt(ch, CURLOPT_REFERER, NULL);
	curl_easy_setopt(ch, CURLOPT_USERAGENT, "foo");
	curl_easy_setopt(ch, CURLOPT_HTTPHEADER, NULL);
	curl_easy_setopt(ch, CURLOPT_COOKIE, NULL);
	curl_easy_setopt(ch, CURLOPT_COOKIELIST, NULL);
	curl_easy_setopt(ch, CURLOPT_RANGE, NULL);
	curl_easy_setopt(ch, CURLOPT_RESUME_FROM, 0L);
	curl_easy_setopt(ch, CURLOPT_MAXFILESIZE, 0L);
	curl_easy_setopt(ch, CURLOPT_TIMECONDITION, 0L);
	curl_easy_setopt(ch, CURLOPT_TIMEVALUE, 0L);
	curl_easy_setopt(ch, CURLOPT_TIMEOUT, 0L);
	curl_easy_setopt(ch, CURLOPT_CONNECTTIMEOUT, 3);
	curl_easy_setopt(ch, CURLOPT_SSLCERT, NULL);
	curl_easy_setopt(ch, CURLOPT_SSLCERTTYPE, NULL);
	curl_easy_setopt(ch, CURLOPT_SSLCERTPASSWD, NULL);
	curl_easy_setopt(ch, CURLOPT_SSLKEY, NULL);
	curl_easy_setopt(ch, CURLOPT_SSLKEYTYPE, NULL);
	curl_easy_setopt(ch, CURLOPT_SSLKEYPASSWD, NULL);
	curl_easy_setopt(ch, CURLOPT_SSLENGINE, NULL);
	curl_easy_setopt(ch, CURLOPT_SSLVERSION, 0L);
	curl_easy_setopt(ch, CURLOPT_SSL_VERIFYPEER, 0L);
	curl_easy_setopt(ch, CURLOPT_SSL_VERIFYHOST, 0L);
	curl_easy_setopt(ch, CURLOPT_SSL_CIPHER_LIST, NULL);
	curl_easy_setopt(ch, CURLOPT_CAINFO, "/etc/ssl/certs/ca-certificates.crt");
	curl_easy_setopt(ch, CURLOPT_CAPATH, NULL);
	curl_easy_setopt(ch, CURLOPT_RANDOM_FILE, NULL);
	curl_easy_setopt(ch, CURLOPT_EGDSOCKET, NULL);
	curl_easy_setopt(ch, CURLOPT_POSTFIELDS, NULL);
	curl_easy_setopt(ch, CURLOPT_POSTFIELDSIZE, 0L);
	curl_easy_setopt(ch, CURLOPT_HTTPPOST, NULL);
	curl_easy_setopt(ch, CURLOPT_IOCTLDATA, NULL);
	curl_easy_setopt(ch, CURLOPT_READDATA, NULL);
	curl_easy_setopt(ch, CURLOPT_INFILESIZE, 0L);
	curl_easy_setopt(ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_NONE);
	curl_easy_setopt(ch, CURLOPT_CUSTOMREQUEST, NULL);
	curl_easy_setopt(ch, CURLOPT_NOBODY, 0L);
	curl_easy_setopt(ch, CURLOPT_POST, 0L);
	curl_easy_setopt(ch, CURLOPT_UPLOAD, 0L);
	curl_easy_setopt(ch, CURLOPT_HTTPGET, 1L);
	curl_easy_setopt(ch, CURLOPT_HTTPHEADER, NULL);
	curl_easy_setopt(ch, CURLOPT_HTTPGET, 1L);
	
	curl_easy_setopt(ch, CURLOPT_WRITEFUNCTION, dummy);
	curl_easy_setopt(ch, CURLOPT_HEADER, NULL);
	curl_easy_setopt(ch, CURLOPT_VERBOSE, VERBOSE);
	curl_easy_setopt(ch, CURLOPT_URL, URL);
	curl_easy_setopt(ch, CURLOPT_COOKIEFILE, "");
	curl_easy_setopt(ch, CURLOPT_SHARE, sh);
}

int main(int argc, char *argv[])
{
	curl_global_init(CURL_GLOBAL_ALL);
	{
		CURL *ch[2] = {curl_easy_init(), curl_easy_init()};
		CURLSH *sh = curl_share_init();
		
		curl_share_setopt(sh, CURLSHOPT_SHARE, CURL_LOCK_DATA_DNS);
		curl_share_setopt(sh, CURLSHOPT_SHARE, CURL_LOCK_DATA_COOKIE);
		
		init(ch[0], sh);
		init(ch[1], sh);
		
		curl_easy_perform(ch[0]);
		curl_easy_perform(ch[1]);
		
		curl_easy_setopt(ch[0], CURLOPT_SHARE, NULL);
		curl_easy_setopt(ch[1], CURLOPT_SHARE, NULL);
		curl_easy_cleanup(ch[0]);
		curl_easy_cleanup(ch[1]);
		curl_share_cleanup(sh);
	}
	curl_global_cleanup();
	return 0;
}

