Resume a Broken Download with curl -C -
Continue a broken download with curl -C - -o file url, which asks the server for the remaining bytes. A server that ignores ranges makes curl stop with exit status 33.
A large download stopped part way, and you want curl to fetch only what is missing instead of starting over.
head -c 400000 remote/big.bin > big.bin
stat -c '%n %s bytes' big.bin
curl -sS -C - -o big.bin http://localhost:8000/big.bin
stat -c '%n %s bytes' big.bin
cmp big.bin remote/big.bin && echo "identical to the original"
curl -sS -C - -o big.bin http://localhost:8001/big.bin
echo "exit status: $?"big.bin 400000 bytes
big.bin 1000000 bytes
identical to the original
curl: (33) HTTP server doesn't seem to support byte ranges. Cannot resume.
exit status: 33With -C - curl looks at the size of the existing output file and sends a Range header that starts at that byte. The run begins with a file cut at 400000 bytes, and the second ls shows 1000000 bytes with cmp finding it identical to the original. The last command goes to a server that ignores Range and answers with the whole body, and curl refuses to append it: HTTP server doesn't seem to support byte ranges, exit status 33. See --continue-at in the manual.
Resuming trusts the partial file, so a file that was damaged before the stop stays damaged; compare a checksum afterward. Use the same -o name as before, and do not combine -C - with a server that changes the file between attempts.