refactor: make --header support in web_get() the same as web_check()
This commit is contained in:
parent
0f69aeae9a
commit
4efd5f7d93
7
quickget
7
quickget
|
@ -1221,6 +1221,7 @@ function web_pipe() {
|
||||||
|
|
||||||
# Download a file from the web
|
# Download a file from the web
|
||||||
function web_get() {
|
function web_get() {
|
||||||
|
local HEADERS=()
|
||||||
local URL="${1}"
|
local URL="${1}"
|
||||||
local DIR="${2}"
|
local DIR="${2}"
|
||||||
local FILE=""
|
local FILE=""
|
||||||
|
@ -1235,14 +1236,16 @@ function web_get() {
|
||||||
# Process any URL redirections after the file name has been extracted
|
# Process any URL redirections after the file name has been extracted
|
||||||
URL=$(web_redirect "${URL}")
|
URL=$(web_redirect "${URL}")
|
||||||
|
|
||||||
|
# Process any headers
|
||||||
while (( "$#" )); do
|
while (( "$#" )); do
|
||||||
if [[ $1 == --header ]]; then
|
if [ "${1}" == "--header" ]; then
|
||||||
HEADERS+=("$1" "$2")
|
HEADERS+=("${1}" "${2}")
|
||||||
shift 2
|
shift 2
|
||||||
else
|
else
|
||||||
shift
|
shift
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# Test mode for ISO
|
# Test mode for ISO
|
||||||
if [ "${just}" == 'show' ]; then
|
if [ "${just}" == 'show' ]; then
|
||||||
echo "${URL}"
|
echo "${URL}"
|
||||||
|
|
Loading…
Reference in New Issue