curl-library
Re: Let the user specify the download buffer
Date: Mon, 31 Mar 2014 19:47:31 +0200 (CEST)
On Mon, 31 Mar 2014, Cristian Morales Vega wrote:
> I would like to have a "CURLOPT_BUFFER" option, so I can instruct libcurl to
> copy the data there directly. What are your thoughts about adding
> it/accepting a patch?
We've discussed such alternatives many times and I'll be willing to do it
again.
Since libcurl may download an infintely large amount of data, just pointing
out a single buffer is not enough. It would have to be the first in a series
of buffers. The question is then how libcurl spends the buffer(s) and how you
give it new/more buffers to fill.
Also, in the attempt to avoid memcpy'ing data in your application, it is
important to realize that you it won't be easy to avoid them in libcurl - I'm
suggesting that it easily will just make the copy get done within libcurl
instead. Things like (abstracted) SSL and chunked encoding for example make it
very hard to avoid that.
If you have any ideas, please let us know and we can go from there. It is
easier to discuss around and improve an actual suggestion.
Lastly, you say this is a performance consideration. Then I presume you imply
that doing a memcpy in the callback is too much? By which measurement? And
what's considered good enough?
-- / daniel.haxx.se ------------------------------------------------------------------- List admin: http://cool.haxx.se/list/listinfo/curl-library Etiquette: http://curl.haxx.se/mail/etiquette.htmlReceived on 2014-03-31