curl-library
libcurl strange behaviour
Date: Wed, 14 Nov 2001 17:59:35 +0100
Dear all,
I m programming a C TCP daemon that forks itself and manage client connection
in separate processes...
The job of these child will be to issue an https query trough curl.
I am making call to curl_global_init, easy_init, easy_cleanup & global
cleanup each time for each process to avoid memory leaks.
Each time i'm testing the daemon, the first forked child succeed in its query
but the second forked child taking care of another client fails to make a
curl_easy_init and the program crash mysteriously
Here is the block of code i am using in a function called http_query (char
*url)
if (curl_global_init(CURL_GLOBAL_ALL)==0) {
curl_handler=curl_easy_init();
log_write(flog, DEBUG, "Initing done URL %s with CURL", url);
curl_easy_setopt(curl_handler,CURLOPT_URL, url);
curl_easy_setopt(curl_handler,CURLOPT_FAILONERROR, 1);
curl_easy_setopt(curl_handler,CURLOPT_LOW_SPEED_LIMIT, 1);
curl_easy_setopt(curl_handler,CURLOPT_LOW_SPEED_TIME, 120);
curl_easy_setopt(curl_handler,CURLOPT_TIMEOUT, 180);
curl_easy_setopt(curl_handler,CURLOPT_NOPROGRESS, 1);
curl_easy_setopt(curl_handler,CURLOPT_ERRORBUFFER,
curl_error);
log_write(flog, DEBUG, "Options set", url);
status=curl_easy_perform(curl_handler);
log_write(flog, DEBUG, "Query executed", url);
curl_easy_cleanup(curl_handler);
curl_global_cleanup();
}
NB : The message "Initing done ..." never appears in the logs.. so i guess
the call to easy_init makes the process crash but as a forked daemon it's
hard to debug it ..
using curl-devel-7.8-1 rpm on redhat 7.2
Any help appreciated.
Thanks & Regards
-- Julien MOUTTE - jmoutte_at_electronic-group.com C.T.O. _________________________________________________________ ELECTRONIC GROUP INTERACTIVE - www.electronic-group.com World Trade Center, Moll de BARCELONA Edificio Norte 4 Planta 08039 BARCELONA SPAIN Tel : +34 93600 23 23 Fax : +34 93600 23 10 _________________________________________________________Received on 2001-11-14