cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Read and write on the same cURL handle

From: Richard W.M. Jones <rjones_at_redhat.com>
Date: Fri, 27 Jun 2014 12:10:24 +0100

On Fri, Jun 27, 2014 at 09:35:20AM +0200, Dan Fandrich wrote:
> 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.

Ok, I can fix that, thanks.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine.  Supports Linux and Windows.
http://people.redhat.com/~rjones/virt-df/
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2014-06-27