From 0f69aeae9aa3cfbf9d762f2d5c972b0b3d49383a Mon Sep 17 00:00:00 2001 From: Martin Wimpress Date: Tue, 23 Apr 2024 06:29:42 +0100 Subject: [PATCH] feat: add --header support to web_check() --- quickget | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/quickget b/quickget index c43ceb0..de6fa34 100755 --- a/quickget +++ b/quickget @@ -1298,9 +1298,19 @@ function web_redirect() { # checks if a URL is reachable function web_check() { + local HEADERS=() local URL="" 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() {