Avoid hanging endlessly on unreachable cache urls

When a download redirector redirects to a broken mirror, timeout
quickly rather than waiting until the overall job is being timed out.

Change-Id: If7eb63d406aaf61f71aa9203cf708c474aa63fd0
This commit is contained in:
Dirk Mueller 2017-06-23 19:05:19 +02:00
parent 016b1f1522
commit 959226c55e

View File

@ -86,7 +86,7 @@ else
success="Downloaded and cached $url for the first time" success="Downloaded and cached $url for the first time"
fi fi
rcode=$(eval curl -v -L -o $tmp -w '%{http_code}' $curl_opts $url $time_cond) rcode=$(curl -v -L -o $tmp -w '%{http_code}' --connect-timeout 10 $curl_opts $url $time_cond)
if [ "$rcode" == "200" -o "${url:0:7}" == "file://" ] ; then if [ "$rcode" == "200" -o "${url:0:7}" == "file://" ] ; then
# In cases where servers ignore the Modified time, # In cases where servers ignore the Modified time,
# curl cancels the download, outputs a 200 and leaves # curl cancels the download, outputs a 200 and leaves