cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Problem using curl to download from sourceforge

From: Daniel Stenberg <daniel-curl_at_haxx.se>
Date: Tue, 2 Dec 2003 18:46:51 +0100 (CET)

On Tue, 2 Dec 2003, Lassi A. Tuura wrote:

[problem description]

I fully understand your problem. Unfortunately, I can't think of any decent
way to trick curl into helping you this this in a comfortable way.

> What would be the best way to make curl select a mirror that actually works?
> I tried looking for an option that would tell curl to keep on trying
> different addresses associated with the host name until one of them
> succeeds, even if one of them allows login but fails actual download, but
> couldn't find any such thing.

No, there's no such option. curl only tries the different IP addresses until
it can connect, then it sticks with that and if the transfer fails it bails
out and won't retry anything else.

The multiple IP feature of DNS is supposed to point to machines that are
equivalent, so trying a different IP would in most cases just make another
attempt of the same failed transfer.

I wouldn't mind seeing some kind of support for this kind of operation added
to libcurl, but there is none now and I personally don't plan on adding this
within a near future.

> Should I start playing tricks with "dig" and tell curl which mirror
> specifically it should try? I'd rather avoid that, but at the moment it
> looks like there's not much of a choice...

I think the "dig game" is your best bet for now:

 #!/bin/sh
 hosts=`dig dl.sourceforge.net | awk '/IN\W*A\W*[1-9]/{print $NF}'`
 for host in $hosts; do
   echo "try $host"
   curl ftp://$host/path/to/file -O
   # then break out of loop after a successful transfer
 done

-- 
    Daniel Stenberg -- http://curl.haxx.se/ -- http://daniel.haxx.se/
 [[ Do not post private mails to this email address. They won't reach me. ]]
-------------------------------------------------------
This SF.net email is sponsored by OSDN's Audience Survey.
Help shape OSDN's sites and tell us what you think. Take this
five minute survey and you could win a $250 Gift Certificate.
http://www.wrgsurveys.com/2003/osdntech03.php?site=8
Received on 2003-12-02