cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Ranged downloads on file:// URLs

From: Daniel Egger <daniel_at_eggers-club.de>
Date: Mon, 7 Jan 2008 13:47:24 +0100

On 07.01.2008, at 13:10, Daniel Stenberg wrote:

> For the fun of it, I removed my version of the patch and applied
> your original one (just in case I have messed it up somehow) and the
> result is... identical. Test 1020 does not work for me with your
> patch.

> Running 32bit Linux 2.6.22 glibc 2.7

Indeed, "negative" ranges are broken with both versions. I'll
investigate
that. Oh, and I was wrong in another regard: -9 is *not* supposed to
mean
the first 10 characters but the last 9. Consider the testcase
withdrawn as
completely bogus.

     else if(from < 0) {
       /* -Y */
       totalsize = -from;
       data->req.maxdownload = -from;
       data->state.resume_from = from;
       DEBUGF(infof(data, "RANGE the last %" FORMAT_OFF_T " bytes\n",
                    totalsize));
     }

So this one is bogus anyway because (resume_from is < 0!)

   if(data->state.resume_from < 0){
     if(stat(file->path, &file_stat)){
       ....
       return CURLE_WRITE_ERROR;
     }
     else
       data->state.resume_from = (curl_off_t)file_stat.st_size;
   }

Here the resume_from "pointer" (which is not my code) is set to the
end of the file.

Maybe something like

data->state.resume_from += (curl_off_t)file_stat.st_size;

would make more sense.

Servus,
       Daniel
Received on 2008-01-07