cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Threads & OpenSSL - Mutex what? Examples?

From: John D <cononet_at_gmail.com>
Date: Thu, 26 Feb 2009 17:29:23 -0800

On Thu, Feb 26, 2009 at 4:38 PM, Toby Peterson <toby_at_apple.com> wrote:

> On Feb 26, 2009, at 4:18 PM, John D wrote:
>
>> On Thu, Feb 26, 2009 at 4:11 PM, Toby Peterson <toby_at_apple.com> wrote:
>>
>
> On Feb 26, 2009, at 4:04 PM, John D wrote:
>>>
>>>> Hello
>>>>
>>>> I would like to know what part of the an easy set operation that occurs
>>>> in a thread
>>>> which involves libcurl accessing an SSL url needs a mutex.
>>>>
>>>> Is there any code out there that actually shows a
>>>>
>>>> CRYPTO_set_locking_callback & CRYPTO_set_id_callback
>>>> specifically in relation to the use with curl_easy_setopt code.
>>>>
>>>> It's understandable to not provide a specific thread safe mechanism
>>>> given the choice of ssl options,
>>>> but not having anything short of a slung together example that does not
>>>> really address the cause of the problem does not fly.
>>>>
>>>> Again and please; How do I specifically avoid crashes when using libcurl
>>>> built with OpenSSL to access an HTTPS page using multiple threads.
>>>>
>>>> Thank you,
>>>>
>>>> john
>>>>
>>>
>>> http://curl.haxx.se/lxr/source/docs/examples/opensslthreadlock.c
>>>
>>
>> Thanks Tony!
>> However that does ziltch to actually demonstrate what I am requesting.
>>
>> This is not a complete stand-alone example. Confirms that.
>>
>> I need to know how to interface the openssl locks with curl_easy_setopt
>> code.
>>
>> My current option is to mutex curl_easy_perform directly
>> which is largely thanks to not a complete stand-alone examples/pseudo
>> code.
>>
>> Thanks all the same Tony.
>>
>> John
>>
>
> Please don't top-post: http://curl.haxx.se/mail/etiquette.html
>
> Anyway, to further expand upon that example... you do not need to
> "interface" OpenSSL and libcurl directly. libcurl will use OpenSSL behind
> the scenes, so if you're using threads you need those callbacks set up ahead
> of time.
>
> - Toby (note the B)

Thank you for the information.
I'll not top-post nor get your name wrong. I promise.

As far as your advice though. I am a little unclear on some things if you
don't mind.

Particularly if thread_setup <ident?i=thread_setup>(void) is being called
only once before all the treads are made or called from within each created
thread.
Same question goes for the destroy I guess.

More so I am still unclear on void
locking_function<ident?i=locking_function>in particular.
I don't grasp if you call this directly and if so where? it is used to
mutex a segment of my own code or automatic calls of the openssl lib.

Please your clarification in this matter is highly appreciated.

Thanks Toby,

John
Received on 2009-02-27