refactor: make --header support in web_get() the same as web_check()

This commit is contained in:
Martin Wimpress 2024-04-23 06:31:02 +01:00 committed by Martin Wimpress
parent 0f69aeae9a
commit 4efd5f7d93
1 changed files with 5 additions and 2 deletions

View File

@ -1221,6 +1221,7 @@ function web_pipe() {
# Download a file from the web
function web_get() {
local HEADERS=()
local URL="${1}"
local DIR="${2}"
local FILE=""
@ -1235,14 +1236,16 @@ function web_get() {
# Process any URL redirections after the file name has been extracted
URL=$(web_redirect "${URL}")
# Process any headers
while (( "$#" )); do
if [[ $1 == --header ]]; then
HEADERS+=("$1" "$2")
if [ "${1}" == "--header" ]; then
HEADERS+=("${1}" "${2}")
shift 2
else
shift
fi
done
# Test mode for ISO
if [ "${just}" == 'show' ]; then
echo "${URL}"