Skip to content

Commit

Permalink
curl: use custom user agent (temporarily using a bit of 1337)
Browse files Browse the repository at this point in the history
  • Loading branch information
lukas2511 committed Mar 1, 2018
1 parent c0bcf91 commit 6827464
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions dehydrated
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ check_dependencies() {

# curl returns with an error code in some ancient versions so we have to catch that
set +e
curl -V > /dev/null 2>&1
CURL_VERSION="$(curl -V 2>&1 | head -n1 | awk '{print $2}')"
retcode="$?"
set -e
if [[ ! "${retcode}" = "0" ]] && [[ ! "${retcode}" = "2" ]]; then
Expand Down Expand Up @@ -499,14 +499,14 @@ http_request() {

set +e
if [[ "${1}" = "head" ]]; then
statuscode="$(curl ${ip_version:-} ${CURL_OPTS} -s -w "%{http_code}" -o "${tempcont}" "${2}" -I)"
statuscode="$(curl ${ip_version:-} ${CURL_OPTS} -A "dehydr4ted/${VERSION} curl/${CURL_VERSION}" -s -w "%{http_code}" -o "${tempcont}" "${2}" -I)"
touch "${tempheaders}"
curlret="${?}"
elif [[ "${1}" = "get" ]]; then
statuscode="$(curl ${ip_version:-} ${CURL_OPTS} -L -s -w "%{http_code}" -o "${tempcont}" -D "${tempheaders}" "${2}")"
statuscode="$(curl ${ip_version:-} ${CURL_OPTS} -A "dehydr4ted/${VERSION} curl/${CURL_VERSION}" -L -s -w "%{http_code}" -o "${tempcont}" -D "${tempheaders}" "${2}")"
curlret="${?}"
elif [[ "${1}" = "post" ]]; then
statuscode="$(curl ${ip_version:-} ${CURL_OPTS} -s -w "%{http_code}" -o "${tempcont}" "${2}" -D "${tempheaders}" -d "${3}")"
statuscode="$(curl ${ip_version:-} ${CURL_OPTS} -A "dehydr4ted/${VERSION} curl/${CURL_VERSION}" -s -w "%{http_code}" -o "${tempcont}" "${2}" -D "${tempheaders}" -d "${3}")"
curlret="${?}"
else
set -e
Expand Down

0 comments on commit 6827464

Please sign in to comment.