From 959226c55e3159af90c2926ed386b382e8bb924e Mon Sep 17 00:00:00 2001 From: Dirk Mueller Date: Fri, 23 Jun 2017 19:05:19 +0200 Subject: [PATCH] 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 --- diskimage_builder/elements/cache-url/bin/cache-url | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/diskimage_builder/elements/cache-url/bin/cache-url b/diskimage_builder/elements/cache-url/bin/cache-url index 121debcb4..50b4d63fc 100755 --- a/diskimage_builder/elements/cache-url/bin/cache-url +++ b/diskimage_builder/elements/cache-url/bin/cache-url @@ -86,7 +86,7 @@ else success="Downloaded and cached $url for the first time" 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 # In cases where servers ignore the Modified time, # curl cancels the download, outputs a 200 and leaves