curl / Mailing Lists / curl-library / Single Mail


Questions regarding curl_easy with SSL and multi threaded

From: Volker Schmid <>
Date: Tue, 14 Mar 2017 14:57:13 +0100


In my software I create a pool of curl-easy handles and re-use them in several threads. On MacOS I have crashes but on Windows and Linux it works fine. I did some research and found the threaded-ssl.c example at

Now I have several questions for which I do not find answers in the web:

- In general, why is the callback needed? I found but the explanation is very basic and I do not know if it applies to me. What exactly is the mutex for? And what is to prevent? No SSL handshakes in multiple threads at the same time? Even with different curl handles? During the whole connection or during a specific functionality?

- Why is libcurl not setting and using the OpenSSL callbacks if it is using the libs and it is obviously needed?

- As I use libcurl by loading it from dll/so/dylib I wonder how I can use and set the callbacks for OpenSSL if I do not even have the OpenSSL library opened?

- I wonder about, how to deal with this if libcurl is not using OpenSSL (eg on Windows using schannel and whatever libcurl is using on Linux or MacOS)?

Can you please help me on those topics?

Thank you!


Received on 2017-03-14