From 4b2b5a63740ef7aa4f967c347c04042060abba6c Mon Sep 17 00:00:00 2001 From: kexkey Date: Wed, 9 Jan 2019 15:49:08 -0500 Subject: [PATCH] Callback failed if response is HTTP code 4xx or 5xx --- proxy_docker/app/script/ots.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/proxy_docker/app/script/ots.sh b/proxy_docker/app/script/ots.sh index 70548cb..b77d79d 100644 --- a/proxy_docker/app/script/ots.sh +++ b/proxy_docker/app/script/ots.sh @@ -201,11 +201,14 @@ serve_ots_backoffice() trace "[serve_ots_backoffice] url=${url}" # Call back newly upgraded stamps - curl -H "X-Forwarded-Proto: https" ${url} + trace "[serve_ots_backoffice] curl -s -o /dev/null -w \"%{http_code}\" -H \"X-Forwarded-Proto: https\" ${url}" + rc=$(curl -s -o /dev/null -w "%{http_code}" -H "X-Forwarded-Proto: https" ${url}) returncode=$? trace_rc ${returncode} - if [ "${returncode}" -eq "0" ]; then + # Even if curl executed ok, we need to make sure the http return code is also ok + + if [ "${returncode}" -eq "0" ] && [ "${rc}" -lt "400" ]; then sql "UPDATE stamp SET calledback=1 WHERE hash=\"${hash}\"" trace_rc $? fi