I intend to make https requests with libcurl and openssl using a C ++ program.
I initialized libcurl with curl_global_init(CURL_GLOBAL_ALL)as described in the documentation. Then I use the descriptor curl_easythat I initialize, fill in the headers and body, and send everything to https://example.com:443/foo '. It works for connections other than https.
Looking around, I discovered that there may be other libraries that are already receiving the SSL context, which is the reason that libcurl fails to do just that. The following error message appears:
curl_easy_perform failed: Out of memory
In my case, I use libmicrohttpd , which I initialize with
mhdDaemon = MHD_start_daemon(MHD_USE_THREAD_PER_CONNECTION | MHD_USE_SSL,
htons(port),
NULL,
NULL,
connectionTreat, NULL,
MHD_OPTION_HTTPS_MEM_KEY, httpsKey,
MHD_OPTION_HTTPS_MEM_CERT, httpsCertificate,
MHD_OPTION_CONNECTION_MEMORY_LIMIT, memoryLimit,
MHD_OPTION_SOCK_ADDR, (struct sockaddr*) &sad,
MHD_OPTION_NOTIFY_COMPLETED, requestCompleted, NULL,
MHD_OPTION_END);
openSSL - . , MHD_USE_SSL, .
, ( cmake):
-lmicrohttpd
-lmongoclient
-lboost_thread
-lboost_filesystem
-lboost_system
-lpthread
, SSL? microhttpd , MHD_USE_SSL ( )? ?