cURL / Mailing Lists / curl-library / Single Mail


I need faster feedback of completion of a request.

From: yi huang <>
Date: Thu, 22 Aug 2013 00:34:24 +0800

I need to get notified when a request is finished, so i can start to
process the response body ASAP.
Currently, my loop is a standard one, which is like this:

while (1) {
    curl_multi_fdset(multi, &fdread, &rdwrite, &fdexcept, &maxfd);
    select(&maxfd, &fdread, &fdwrite, &fdexcept, timeout);
    curl_multi_perform(multi, &running_handles);
    while ((msg = curl_multi_info_read(multi, &leftmsgs)!=NULL) {

Then i set timeout of select to 5 seconds(i don't want to wast too
much cpu cycles), but i found that the process_response_body always
delayed by 5 seconds.
I've investigated this by reading the source code of libcurl, i found
out that after the last read of a http response, the easy_handle enter
the CURLM_STATE_DONE state, and in next curl_multi_perform call, it
enter CURLM_STATE_COMPLETED state, then the CURLMSG_DONE message got
append to multi->msglist, then use code can detect the completion of a
So i have to wait for another cycle to process my response body, and
when io is not busy, this cycle can be very long.
It there another option for my requirement? Thanks.
List admin:
Received on 2013-08-21