Skip to content

Commit

Permalink
Remove empty response code validation
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabriel Fernandes committed Jul 29, 2020
1 parent e895b6b commit ca8e59a
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions php-fpm-healthcheck
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
# 4 - One or more required softwares are missing
# 8 - Couldn't reach PHP fpm status page, have you configured it with `pm.status_path = /status`?
# 9 - Couldn't connect to PHP fpm, is it running?
# 10 - Malformed PHP fpm status page
# 111 - Couldn't connect to PHP fpm, is it running?
#
# Available options:
Expand Down Expand Up @@ -58,12 +57,7 @@ get_fpm_status() {
if test "$VERBOSE" = 1; then printf "Trying to connect to PHP-FPM via: %s%s\\n" "$1" "$SCRIPT_NAME"; fi;

FPM_STATUS=$(env -i REQUEST_METHOD="$REQUEST_METHOD" SCRIPT_NAME="$SCRIPT_NAME" SCRIPT_FILENAME="$SCRIPT_FILENAME" "$FCGI_CMD_PATH" -bind -connect "$1" 2> /dev/null)

RESPONSE_CODE=$(echo "$FPM_STATUS" | grep -o -E "^Status:\s*\d{3}" | sed 's/[^0-9]*//g')
if ! test "$RESPONSE_CODE" -eq "$RESPONSE_CODE" 2> /dev/null; then
>&2 echo "Malformed PHP-FPM status page. Aborting.";
exit 10;
fi
RESPONSE_CODE=$(echo "$FPM_STATUS" | grep "^Status:" | sed 's/[^0-9]*//g')

if test "$RESPONSE_CODE" -lt 200 -o "$RESPONSE_CODE" -ge 400; then
>&2 printf "Unable to reach PHP-FPM status page. Response code: %s\\n" "$RESPONSE_CODE";
Expand Down

0 comments on commit ca8e59a

Please sign in to comment.