Haxx ad

curl's project page on


cURL > Mailing List > Monthly Index > Single Mail

curl-library Mailing List Archives

curl_multi_perform no request data seen on POST?

From: Vemana Yogi <>
Date: Tue, 15 Jun 2010 17:46:51 -0700


I'm just trying to get my question across so on purpose I'm skipping some
code or error checks here and focusing on the relevant pieces.
I am posting data to services vi the CURLOPT_READFUNCTION and am using
curl_multi_perform. I have also used the trace and dump snippet on the
website and pasted the output below. So the issue I am facing is that, when
curl_multi_perform is called, I see that requestWriter function is not
called and the content is empty - Any idea?

int handles = 2;

for(int i =0 ; i < handles; i++) {
     CURL *curl = curl_easy_init();

     CURLcode cc = curl_easy_setopt(curl, CURLOPT_URL, url);

      if (debug) {
          curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
          curl_easy_setopt(curl, CURLOPT_DEBUGFUNCTION, my_trace);
          curl_easy_setopt(curl, CURLOPT_DEBUGDATA, alldata[i]);

       curl_easy_setopt(curl, CURLOPT_HEADERFUNCTION, headerWriter);
       curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, responseBody);
       curl_easy_setopt(curl, CURLOPT_WRITEDATA, alldata[i]);
       //curl_easy_setopt(curl, CURLOPT_READFUNCTION, requestWriter);
       //curl_easy_setopt(curl, CURLOPT_READDATA, alldata[i]]);
        curl_easy_setopt(curl, CURLOPT_POST, 1);

Just a debugging thing to verify..
        vector<struct CurlParams>::iterator it;
        cout << "req vector contains: "<<endl;
        for ( it=alldata.begin() ; it < alldata.end(); it++ ) {
          cout << "Status: " << (*it).httpStatus<<endl;
          cout << "Postbody: " << (*it).postbody<<endl;
          cout << "Posturl: " << (*it).posturl<<endl;
          cout << "Postrem: " << (*it).postrem<<endl;

      cmc = curl_multi_add_handle(mh, curl);
} //end of for;

int nRunning;
cout<"Calling multiperform for handle %s", url.c_str());
        int ncalls = 1;

while ((cmc = curl_multi_perform(mh, &nRunning)) ==
            cout<<"curl_multi_perform():%s, nRunning=%d:Calling again",
curl_multi_strerror(cmc), nRunning";



handles :2

data size = 226
req vector contains:
Status: 0
Postbody: {s
Postrem: 226
INFO:addHandles:408:Muli-handle 0 added successfully
Entering my_trace....
== Info: STATE: INIT => CONNECT handle 0x10ca184; (connection #-5000)

Entering my_trace....
== Info: STATE: CONNECT => DO handle 0x10ca184; (connection #0) - curl_multi_perform():Please call
curl_multi_perform() soon, nRunning=1:Calling again
Entering my_trace....
this one - => Send header, POST /v1/232323 HTTP/1.1
Accept: */*
Content-Type: application/json
Content-Length: 0

????????????????????????????????????????????????????, 0000000160 bytes
0000: POST /v1/232323 HTTP/1.1
0029: Host:
005d: Accept: */*
006a: Content-Type: application/json
008b: Content-Length: 0
leavin my_trace....



List admin:
Received on 2010-06-16

These mail archives are generated by hypermail.

donate! Page updated November 12, 2010.
web site info

File upload with ASP.NET