cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: curl (on Windows Vista 64 Bit edition) does only write partial file when doing download via redirect

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Wed, 1 Jun 2011 13:35:01 +0200 (CEST)

On Wed, 1 Jun 2011, Martin Maurer wrote:

> Around every two hours i see that hijk.js is a bit too small. curl itself
> reports the amount of bytes, which the original file had. The written
> content seems to be on a 4 KByte (not completely sure, but at least on a 1
> KByte boundary). The last pieces from boundary to end of file is missing. It
> looks like writing to stdout which is redirected to hijk.js is not yet
> complete, when file compare is done. According to wireshark it looks like
> the file was completely downloaded, with no error, also the last missing
> content is displayed as correctly transfered. This leads me to the opinion,
> that something on PC side is not working.
>
> Is there perhaps a flush missing ?

Since curl exits when done, all file handles are flushed automatically.

You can use --trace-ascii or similar to see exactly what curl has received.

In Windows land, lots of the stuff that is related to files and filesystems
are a bit peculiar so it wouldn't at all surprise me if there at times could
be so that the kernel hasn't yet completely finished writing all the data to
the file when you try to read it. Possibly you should add a short pause
between the curl invoke and the use of the file.

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ:        http://curl.haxx.se/docs/faq.html
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2011-06-01