dev/bin/find_sparkle_appcast: send browser headers

This commit is contained in:
Vítor Galvão 2016-01-30 22:33:28 +00:00
parent cd6d7ca9ef
commit 13da90406f
1 changed files with 3 additions and 2 deletions

View File

@ -1,5 +1,6 @@
#!/bin/bash
readonly browser_headers=(--header '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')
usage() {
local program exit_status
@ -50,10 +51,10 @@ if [[ -z "${appcast_url}" ]]; then
fi
# validate appcast
appcast_http_response="$(curl --silent --head --write-out '%{http_code}' "${appcast_url}" -o /dev/null)"
appcast_http_response="$(curl --silent --head "${browser_headers[@]}" --write-out '%{http_code}' "${appcast_url}" -o /dev/null)"
[[ "${appcast_http_response}" != '200' ]] && appcast_found_error "returned a non-200 (OK) HTTP response code (${appcast_http_response})"
appcast_checkpoint=$(curl --silent --compressed "${appcast_url}" | sed 's|<pubDate>[^<]*</pubDate>||g' | shasum --algorithm 256 | awk '{ print $1 }')
appcast_checkpoint=$(curl --silent --compressed --location "${browser_headers[@]}" "${appcast_url}" | sed 's|<pubDate>[^<]*</pubDate>||g' | shasum --algorithm 256 | awk '{ print $1 }')
[[ "${appcast_checkpoint}" == 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855' ]] && appcast_found_error 'seems to be empty'
# output appcast