cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: zero-length files

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Wed, 12 Nov 2008 20:07:20 +0100 (CET)

On Wed, 12 Nov 2008, Michal Marek wrote:

> handling of zero-length files is a bit suboptimal:

Yeah, support for zero byte files have always been a low prio for us (me?). I
think the best approach is to simply create a bunch of test cases for various
protocols with empty files and then fix the code and make sure the tests run
fine. There might even be zero byte issues in the test suite itself...

> Also this looks like a bug in Curl_client_write():
>
> if(data->req.keepon & KEEP_READ_PAUSE) {
> ...
> newlen = len + data->state.tempwritesize;
> ...
> memcpy(newptr + data->state.tempwritesize, ptr, len);
> ...
> }
>
> if(0 == len)
> len = strlen(ptr);
>
> The check for 0 == len should IMO be done first, otherwise we might lose
> data.

I fully agree. Will you do the commit?

-- 
  / daniel.haxx.se
Received on 2008-11-12