File tree Expand file tree Collapse file tree 1 file changed +16
-3
lines changed Expand file tree Collapse file tree 1 file changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -301,7 +301,7 @@ http_download_curl() {
301301 code=$( curl -w ' %{http_code}' -sL -H " $header " -o " $local_file " " $source_url " )
302302 fi
303303 if [ " $code " != " 200" ]; then
304- log_debug " http_download_curl received HTTP status $code "
304+ log_err " http_download_curl received HTTP status $code "
305305 return 1
306306 fi
307307 return 0
@@ -310,11 +310,24 @@ http_download_wget() {
310310 local_file=$1
311311 source_url=$2
312312 header=$3
313+ local wget_output
314+ local code
313315 if [ -z " $header " ]; then
314- wget -q - O " $local_file " " $source_url "
316+ wget_output= $( wget --server-response --quiet - O " $local_file " " $source_url " 2>&1 )
315317 else
316- wget -q --header " $header " -O " $local_file " " $source_url "
318+ wget_output= $( wget --server-response --quiet -- header " $header " -O " $local_file " " $source_url " 2>&1 )
317319 fi
320+ local wget_exit=$?
321+ if [ $wget_exit -ne 0 ]; then
322+ log_err " http_download_wget failed: wget exited with status $wget_exit "
323+ return 1
324+ fi
325+ code=$( echo " $wget_output " | awk ' /^ HTTP/{print $2}' | tail -n1)
326+ if [ " $code " != " 200" ]; then
327+ log_err " http_download_wget received HTTP status $code "
328+ return 1
329+ fi
330+ return 0
318331}
319332http_download () {
320333 log_debug " http_download $2 "
You can’t perform that action at this time.
0 commit comments