From 4c77c208d9c206ae2c2ec6b6bad9ce638468eb55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADtor=20Galv=C3=A3o?= Date: Sun, 10 Jan 2016 20:53:50 +0000 Subject: [PATCH] cask-switch-https: improved getting cask_status --- developer/bin/cask-switch-https | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/developer/bin/cask-switch-https b/developer/bin/cask-switch-https index e24c1ec9ac..d958f96303 100755 --- a/developer/bin/cask-switch-https +++ b/developer/bin/cask-switch-https @@ -66,7 +66,7 @@ check_url_for_https() { # check if the URL sends a 200 HTTP code, else abort browser_headers="User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.152 Safari/537.36" - cask_status=$(curl --silent ${verbose_option}--head --max-time 10 --proto =https --location --header "${browser_headers}" "${cask_url}") + cask_status=$(curl --silent ${verbose_option} --head --max-time 10 --proto =https --location --header "${browser_headers}" --write-out '%{http_code}' "${cask_url}" -o '/dev/null') exit_code=$? if [[ exit_code -ne 0 ]]; then @@ -74,8 +74,6 @@ check_url_for_https() { return 1 fi - cask_status=$(echo ${cask_status} | grep '^HTTP' | tail -1 | perl -pe 's|.* (\d{3}) .*|\1|') - if [[ "${cask_status}" != '200' ]]; then if [[ -z "${cask_status}" ]]; then echo "URL ${cask_url} is not reachable!"