/usr/lib/fetch-url/http is in ubiquity 2.18.7.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | protocol_fetch() {
local url file RETVAL i j options
url="$1"
file="$2"
options=
wget404() {
# see README.wget404 in the debian-installer-utils udeb source for more info about this
if [ "ftp" = "$proto" ] ; then
local file_not_found_pattern='bad response to RETR: 550 \|^No such file '
else
local file_not_found_pattern='server returned error: HTTP\/[0-9.]\+ 404 \| ERROR 404: '
fi
local RETVAL=$( {
echo 1
wget "$@" 2>&1 >&3 && echo %OK%
echo %EOF%
} | ( sed -ne '1{h;d};/'"$file_not_found_pattern"'/{p;s/.*/4/;h;d};/^%OK%$/{s/.*/0/;h;d};$!p;$x;$w /dev/fd/4' >&2 ) 4>&1
) 3>&1
return $RETVAL
}
# use the proxy for wgets (should speed things up)
if db_get mirror/$proto/proxy; then
export ${proto}_proxy="$RET"
fi
if wget --version 2>/dev/null | grep -q 'GNU Wget'; then
options=--no-verbose
if [ "https" = "$proto" ] && \
db_get debian-installer/allow_unauthenticated_ssl && [ "$RET" = true ]; then
options="$options --no-check-certificate"
fi
else
if [ "https" = "$proto" ]; then
echo "busybox wget does not support https" >&2
return 1
fi
options=-q
fi
RETVAL=0
for i in 1 2; do
wget404 $options -O "$file" "$url" || RETVAL=$?
[ $RETVAL = 1 ] || return $RETVAL
if [ "$TRY_CONTINUE" ] && [ -s "$file" ]; then
for j in 1 2 3; do
wget404 -c $options "$url" -O "$file" || RETVAL=$?
[ $RETVAL = 1 ] || return $RETVAL
done
fi
[ "$TRY_REPEAT" ] || break
done
return $RETVAL
}
|