cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: easy API: curl_easy_perform() doesn't return after receiving all data

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Wed, 1 Nov 2006 13:14:10 +0100 (CET)

On Wed, 1 Nov 2006, James Buchanan wrote:

> I'm using libCURL to use a SOAP web service. Everything works fine, except
> that when I receive my response, using curl_easy_perform(), even after I
> have received all the response data the function doesn't return. I have to
> hit CTRL+C to see the results.

What libcurl version on what platform?

What libcurl options do you set in your request? How does your request-headers
look like and what response-headers do you get when you see the problem?

Doe the problem show up every time?

> To get my SOAP response envelope, I have to watch for "</SOAP-ENV:Envelope>"
> in my CURLOPT_READFUNCTION, otherwise I get all my data but
> curl_easy_perform() never returns. I have to keep an eye out for
> "</SOAP-ENV:Envelope>" and then parse my XML SOAP response and display the
> results.

To me, all this sounds like a server problem.

> Is there some way I can call curl_easy_perform() multiple times, and let it
> try to use the same connection/socket, but as soon as the data has been
> received return form curl_easy_perform()? Maybe there's an option I can set
> with curl_easy_setopt()?

curl_easy_perform() SHOULD return after the full response has been received.
Everything else is a bug in either end.

> Perhaps I should note that I'm doing a POST to send the SOAP XML envelope,
> but the response from the server is chunked, so there's no Content-Length
> header received in the response. Would this confuse CURL thinking more data
> might be coming along?

No, libcurl has fully functional chunked-encoding support. Can you show us a
full stream of what you get back, and then especially the end of the chunked
body repsponse? (If that is a lot of data, then preferably pasted somewhere
and not included in a mail.)

-- 
  Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
Received on 2006-11-01