Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --- dehydrated.0.6.5 2019-10-09 10:47:26.300469301 +0200
- +++ dehydrated 2019-10-09 10:38:48.859796485 +0200
- @@ -154,7 +154,9 @@
- DEHYDRATED_USER=
- DEHYDRATED_GROUP=
- API="auto"
- -
- + HTTP_RETRY_COUNT="5"
- + HTTP_RETRY_DELAY="1"
- +
- if [[ -z "${CONFIG:-}" ]]; then
- echo "#" >&2
- echo "# !! WARNING !! No main config file found, using default config!" >&2
- @@ -528,16 +530,46 @@
- fi
- set +e
- - if [[ "${1}" = "head" ]]; then
- - statuscode="$(curl ${ip_version:-} ${CURL_OPTS} -A "dehydrated/${VERSION} curl/${CURL_VERSION}" -s -w "%{http_code}" -o "${tempcont}" "${2}" -I)"
- - curlret="${?}"
- - touch "${tempheaders}"
- + if [[ "${1}" = "head" ]] ; then
- + while true ; do
- + statuscode="$(curl ${ip_version:-} ${CURL_OPTS} -A "dehydrated/${VERSION} curl/${CURL_VERSION}" -s -w "%{http_code}" -o "${tempcont}" "${2}" -I)"
- + curlret="${?}"
- + touch "${tempheaders}"
- + if [[ ! "${curlret}" = "0" ]]; then
- + HTTP_RETRY_COUNT=$((HTTP_RETRY_COUNT-1))
- + if [[ ! "${HTTP_RETRY_COUNT}" -lt "0" ]]; then
- + sleep "$HTTP_RETRY_DELAY"
- + continue
- + fi
- + fi
- + break
- + done
- elif [[ "${1}" = "get" ]]; then
- - statuscode="$(curl ${ip_version:-} ${CURL_OPTS} -A "dehydrated/${VERSION} curl/${CURL_VERSION}" -L -s -w "%{http_code}" -o "${tempcont}" -D "${tempheaders}" "${2}")"
- - curlret="${?}"
- + while true ; do
- + statuscode="$(curl ${ip_version:-} ${CURL_OPTS} -A "dehydrated/${VERSION} curl/${CURL_VERSION}" -L -s -w "%{http_code}" -o "${tempcont}" -D "${tempheaders}" "${2}")"
- + curlret="${?}"
- + if [[ ! "${curlret}" = "0" ]]; then
- + HTTP_RETRY_COUNT=$((HTTP_RETRY_COUNT-1))
- + if [[ ! "${HTTP_RETRY_COUNT}" -lt "0" ]]; then
- + sleep "$HTTP_RETRY_DELAY"
- + continue
- + fi
- + fi
- + break
- + done
- elif [[ "${1}" = "post" ]]; then
- - statuscode="$(curl ${ip_version:-} ${CURL_OPTS} -A "dehydrated/${VERSION} curl/${CURL_VERSION}" -s -w "%{http_code}" -o "${tempcont}" "${2}" -D "${tempheaders}" -H 'Content-Type: application/jose+json' -d "${3}")"
- - curlret="${?}"
- + while true ; do
- + statuscode="$(curl ${ip_version:-} ${CURL_OPTS} -A "dehydrated/${VERSION} curl/${CURL_VERSION}" -s -w "%{http_code}" -o "${tempcont}" "${2}" -D "${tempheaders}" -H 'Content-Type: application/jose+json' -d "${3}")"
- + curlret="${?}"
- + if [[ ! "${curlret}" = "0" ]]; then
- + HTTP_RETRY_COUNT=$((HTTP_RETRY_COUNT-1))
- + if [[ ! "${HTTP_RETRY_COUNT}" -lt "0" ]]; then
- + sleep "$HTTP_RETRY_DELAY"
- + continue
- + fi
- + fi
- + break
- + done
- else
- set -e
- _exiterr "Unknown request method: ${1}"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement