cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: curl doesn't download full jar and doesn't fail despite --fail

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Sat, 30 Apr 2011 23:15:46 +0200 (CEST)

On Sat, 30 Apr 2011, Gabriele Kahlout wrote:

> $ curl -O --fail -L
> http://downloads.sourceforge.net/project/dp4j/$v/$jar_file
>
> However, comparing sizes the downloaded jar is invalid. However --fail
> didn't complain.

--fail makes curl fail instead of doing a download if the server returns an
error. If it instead returns content, --fail will not have any effect.

Your lack of details in what exactly you got and what headers the server
responded with, we can't properly guess what happened. In most cases curl
detects early disconnects or other failures to download the full file and will
tell you about it. There are however edge cases where it can't detect a
disconnect from a legitimate end of file.

> What should I do?

First, show us all HTTP headers that your server responds with in this case.

> Should it be just expected that from time to time curl won't download the
> complete jar

A TCP connection isn't failsafe. Sometimes it will break and then curl will
have gotten a broken image. But curl is able to inform about when this happens
except for some rare cases...

> I must retry and rely on md5sum

An md5sum could still be a good idea as it would help you to exclude other
possible error sources as well.

-- 
  / 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-04-30