cURL / Mailing Lists / curl-library / Single Mail


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

From: Sebastian Rasmussen <>
Date: Fri, 05 Oct 2012 19:03:47 +0200


> 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!

Alright, how about something along the lines of the attached?

Basically I'm adding a CURLOPT_UNBUFFERED_WRITES which causes libcurl to
call setbuf() with NULL, and also to call fsync() to make sure that the
written file data actually makes it to the file system (whether it makes
it to disk is an entirely different matter).

I'm not confident enough about how curl's test harness works to add a
test that sets this option and tests it. I'm not even sure what such a
test can do apart from just making sure that the CURLOPT is accepted.
But as you can see from the patch I'm hoping for the patch to eventually
be included in 7.27.1. :)

  / Sebastian

PS. Let me know if you prefer me to quote the code inline instead, I'm
happy to do so I'm just not sure that you prefer this on curl-library.

Received on 2012-10-05