curl-library
Re: Read and write on the same cURL handle
Date: Fri, 27 Jun 2014 09:35:20 +0200
On Thu, Jun 26, 2014 at 02:50:57PM +0100, Richard W.M. Jones wrote:
> Maybe the confusion is that I'm using the "easy" API, and in each call
> I'm using curl_easy_perform in a loop until the read or write is
> finished. See:
> https://github.com/libguestfs/nbdkit/blob/master/plugins/curl/curl.c#L310
The loop around curl_easy_perform shows a fundamental misunderstanding of how
the API works. curl_easy_perform() should be called only once, and once the
transfer that has been set up on the handle has been completed, the function
returns. Calling it in a loop is equivalent to clicking on the same link in a
browser over and over again. Once the transfer is complete, you can use
curl_easy_getinfo to query information about the transfer that just occurred.
>>> Dan
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2014-06-27