cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Reg: curl_multi_perform

From: Linus Nielsen Feltzing <linus_at_haxx.se>
Date: Tue, 21 Apr 2009 10:47:37 +0200

Savitha Perumal wrote:
>> * Things are getting messed up if the size of the POST field is more than
>> 1024k .
>
>> Request 1 : abc123456......
>> Request 2 : def123456......
>
>> During the time of processing, I see that curl is posting a request as
>> "abc1234def123456...."

I see a problem with your code:

   curl_easy_setopt(curl, CURLOPT_POSTFIELDS, params_encrypted);

Since you are running several handles in parallel, you need to use the
CURLOPT_COPYPOSTFIELDS option, otherwise you will overwrite the POST
data for the running handles if they take more than 10ms to run.

I suggest the following change:

   strcpy( params_encrypted, "testing");
   substr(params_prefix, params_encrypted, 5, 10);
   curl_easy_setopt(curl, CURLOPT_COPYPOSTFIELDS, params_encrypted);

This will make libcurl use a copy instead of the live data.

Regards,

Linus
Received on 2009-04-21