cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: fflush()ing libcurl's FILE* for the file:// protocol...

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Fri, 5 Oct 2012 10:17:15 +0200 (CEST)

On Fri, 5 Oct 2012, Sebastian Rasmussen wrote:

>> I think a much more straightforward approach would be simply to have a
>> CURLOPT that sets unbuffered mode for the FILE object (i.e. calls setbuf()
>> with no buffer given).
>
> That works well too of course, how about making it possible to set the
> buffer size in bytes and having 0 represent unbuffered..? Or you think this
> is overkill?

I too find using the return code a bit hard to use. It would introduce a very
funny code flow for an application. Also, adding a setopt would make older
versions of libcurl just keep working buffered (since the setopt would use an
unknown option) while the return code change would make older versions of
libcurl return errors on the new usage.

I personally rather lean on simply changing the output to unbuffered
unconditionally and always and instead rather have us rely on the file system
layer doing the right thing. That would be completely backwards compatible
too!

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2012-10-05