curl-library
easy API: curl_easy_perform() doesn't return after receiving all data
Date: Wed, 1 Nov 2006 22:07:49 +1100
Hello fellow programmers,
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.
// Doesn't seem to solve my problem
// http_headers = curl_slist_append(http_headers, "Connection: Close");
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.
I was thinking I could watch for "</SOAP-ENV:Envelope>" and then do
the cleanups for CURL after I have seen it, but then curl_easy_perform
wouldn't return would it, since its state would have been cleaned up
prematurely?
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()?
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?
Thanks for your help, greatly appreciated if you can.
Spartacus
Received on 2006-11-01