feat: add --header support to web_check()
This commit is contained in:
parent
02b93d9bbe
commit
0f69aeae9a
12
quickget
12
quickget
|
@ -1298,9 +1298,19 @@ function web_redirect() {
|
||||||
|
|
||||||
# checks if a URL is reachable
|
# checks if a URL is reachable
|
||||||
function web_check() {
|
function web_check() {
|
||||||
|
local HEADERS=()
|
||||||
local URL=""
|
local URL=""
|
||||||
URL=$(web_redirect "${1}")
|
URL=$(web_redirect "${1}")
|
||||||
curl --silent --location --head --output /dev/null --fail "${URL}"
|
# Process any headers
|
||||||
|
while (( "$#" )); do
|
||||||
|
if [ "${1}" == "--header" ]; then
|
||||||
|
HEADERS+=("${1}" "${2}")
|
||||||
|
shift 2
|
||||||
|
else
|
||||||
|
shift
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
curl --silent --location --head --output /dev/null --fail "${HEADERS[@]}" "${URL}"
|
||||||
}
|
}
|
||||||
|
|
||||||
function zsync_get() {
|
function zsync_get() {
|
||||||
|
|
Loading…
Reference in New Issue