cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: curl_multi_perform: Is there any way to know about the end of response after doing curl multi perform

From: venkat akella <akellav_at_gmail.com>
Date: Fri, 17 Nov 2006 15:44:56 -0800

Thanks for the quick response. This is what happening in my case.

I am using HTTP 1.1 persistent connections. when I call
curl_multi_perform(), client is sending the POST request to HTTP server and
I am getting the response back. In my case response doesnt have body and
headers. Response just has the status line. Response I received is "HTTP/1.1
200 OK\r\n\r\n". Even though curl_multi_perform() call is giving me the
complete response (In my case just status line), running_handles is not
getting set to 0. Its still 1 after this call.
Can anyone please let me know what might be going wrong? OR is there a bug
in curl with persistent connection and receiving just status line.

I have tested with both curl-7.15.0 and curl-7.16.0.

Thanks for your comments

On 11/17/06, Daniel Stenberg <daniel_at_haxx.se> wrote:
>
> On Wed, 15 Nov 2006, venkat akella wrote:
>
> (Please stop submitting this multiple times, it does not good but only
> annoys
> us all.)
>
> > I am calling curl_multi_perform() to send/receive the http
> > request/response. curl_multi_perform() call returns CURLM_OK and
> > still_running is populated with 1.
>
> Yes, it will do that until the whole response is received.
>
> > Q1. For HTTP1.1 persistent connections, when the running_handles of
> > curl_multi_perform(multi_handle, &running_handles) is going to be zero?
> I am
> > asking this because even after sending a request and receiving resopnse
> for
> > that request, running_handles is set to 1. So, is running_handles will
> be
> > set to zero only after all the connections(Even persistent connections)
> are
> > closed?
>
> It goes to 0 when the whole response have been received.
>
> > Q2. With a call to curl_multi_perform(multi_handle, &running_handles), I
> > sent a request to server and received the response. My question is how
> do I
> > know whether I received the complete response or not during the
> > curl_multi_perform() call in my program.
>
> The number of "running_handles" decreases and you can read info about it
> with
> curl_multi_info_read().
>
> AFAIK, these details are documented.
>
> --
> Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
>
Received on 2006-11-18