commit a3b6627ae945c11af92c8bb079bf4a12b8ae4c28
parent 105a067b48a2e258b39e20a7b74078f2ebb6d8f0
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Wed, 18 Jul 2018 18:10:35 +0200
sfeed_update: fail on feed HTTP redirect
Make curl fail (return a non-zero exit status) on a HTTP redirect. This makes
sure sfeed_update shows the feed as "FAILED" instead of succesful with zero
data.
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sfeed_update b/sfeed_update
@@ -40,7 +40,7 @@ merge() {
# fetch a feed via HTTP/HTTPS etc.
# fetchfeed(url, name, feedfile)
fetchfeed() {
- if curl -H 'User-Agent:' -f -s -S --max-time 15 -z "$3" "$1"; then
+ if curl -L --max-redirs 0 -H 'User-Agent:' -f -s -S -m 15 -z "$3" "$1" 2>/dev/null; then
printf " OK %s %s\n" "$(date +'%H:%M:%S')" "$2" >&2
else
printf "FAIL %s %s\n" "$(date +'%H:%M:%S')" "$2" >&2