On Wed, 18 Oct 2017, Luca Niccoli via curl-library wrote:

Is it legal to invoke curl_multi_remove_handle from inside the write
callback passed as CURLOPT_WRITEFUNCTION to curl_easy_setopt?

No.

You should not call _any_ libcurl functions from within callbacks unless they are specifically documented to allow that.

Right now, I can only think of the curl_pushheader_by*() functions that are made for and documented to allow that. (can be used from within CURLMOPT_PUSHFUNCTION callbacks.)

I've actually been wanting for quite some time now to add some protection logic to the API functions that will make them return error if called from within callbacks, but I've just not managed to get it done! =)

I know there are users who call curl_easy_getinfo() from within callbacks and I think we should consider documenting that as okay. And if we do, add some tests that verify that it also works...

--

 / daniel.haxx.se
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:   https://curl.haxx.se/mail/etiquette.html

Reply via email to