curl-library
multi_perform in sequence fails
Date: Mon, 29 May 2006 18:30:19 +0530
Hello All,
My application tries to call curl_multi_perform function in seqence
(multiple times) with different data set with POSTFILEDS option.
Data goes successfully only first time but fails on subsequent
multi_perform.
Here is overall flow of application:
do_perform(multi_handle)
{
/*This function does typical curl_multi_peroform operation and check
for return status */
}
init_curl(CURLM **multi_handle, CURLM **out_handle)
{
*out_handle = curl_easy_init();
/* This function initialize all options required by application as */
/*
CURLOPT_URL,CURLOPT_HTTPPOST, CURLOPT_WRITEFUNCTION,
CURLOPT_WRITEDATA
CURLOPT_HTTPHEADER, CURLOPT_HTTPAUTH,
*/
*multi_handle = curl_multi_init();
if(CURLE_OK != (curlrc = curl_multi_add_handle(*multi_handle,
*out_handle))) return curlrc;
}
main()
{
CURL *out_handle = NULL;
CURLM *multi_handle = NULL;
char out_buf[100];
init_curl(&multi_handle, &out_handle);
/*Set outgoing buffer */
strcpy(out_buffer, "initial data");
curl_easy_setopt(out_handle, CURLOPT_POSTFIELDS, out_buf);
do_perform(&multi_handle); ///--------- This works. Data is send to
server
strcpy(out_buffer, "subsequent data");
curl_easy_setopt(out_handle, CURLOPT_POSTFIELDS, out_buf);
do_perform(&multi_handle); ///--------- Here, data is not send to
server
* /* If I call init_curl again before curl_east_setopt, Things works
fine */*
/*All cleanup code is here */
}
Any idea whats missing here or something else need to be done ?
-- NileshReceived on 2006-05-29