curl-library
Re: Zero-copy interface
Date: Mon, 19 Jul 2010 12:07:33 -0700
> On 12 Jul 2010, at 12:18 PM, Daniel Stenberg wrote:
> Possibly it could be made as another callback: getbuffer()
>
> getbuffer() gets called when libcurl needs a new buffer, and the buffer you
> provide to libcurl with that callback must be able to hold at least
> CURL_MAX_WRITE_SIZE bytes. When libcurl calls the write callback, it will
> pass on a pointer to within that buffer and a length. Note that it MAY not
> point to the first byte of the passed-in buffer.
I see a problem here, in that CURL_MAX_WRITE_SIZE is defined at compile time,
yet the application could be linked at run time to a libcurl that used a
different value. If libcurl's value were greater, then it will overwrite
the end of the buffer passed in.
What is probably needed is a curl_easy_getinfo analog to the curl_easy_setopt
option CURLOPT_BUFFERSIZE to query at run time what size is expected, or just
force the zero copy interface user to set CURLOPT_BUFFERSIZE at least once
before supplying a buffer.
>>> Dan
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2010-07-19