diff options
author | Christian König <ckoenig@posteo.de> | 2022-07-27 01:07:24 +0300 |
---|---|---|
committer | Adam Warner <me@adamwarner.co.uk> | 2022-08-08 19:20:41 +0300 |
commit | b98e3313759034e3cfe60eb1a7830381b1cf4af9 (patch) | |
tree | 2b38cfa90c4164bc132b90a3c035383771aa628a /advanced | |
parent | 6c9bd7a6328f892884b9e55064c61fa08b7682fe (diff) |
Only do one curl call in debug when checking the X-Header
Signed-off-by: Christian König <ckoenig@posteo.de>
Diffstat (limited to 'advanced')
-rwxr-xr-x | advanced/Scripts/piholeDebug.sh | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/advanced/Scripts/piholeDebug.sh b/advanced/Scripts/piholeDebug.sh index 79452f00..aff2ee9d 100755 --- a/advanced/Scripts/piholeDebug.sh +++ b/advanced/Scripts/piholeDebug.sh @@ -797,13 +797,13 @@ check_x_headers() { # server is operating correctly echo_current_diagnostic "Dashboard and block page" # Use curl -I to get the header and parse out just the X-Pi-hole one + local full_curl_output_dashboard local dashboard - dashboard=$(curl -Is localhost/admin/ | awk '/X-Pi-hole/' | tr -d '\r') + full_curl_output_dashboard="$(curl -Is localhost/admin/)" + dashboard=$(echo "${full_curl_output_dashboard}" | awk '/X-Pi-hole/' | tr -d '\r') # Store what the X-Header should be in variables for comparison later local dashboard_working dashboard_working="X-Pi-hole: The Pi-hole Web interface is working!" - local full_curl_output_dashboard - full_curl_output_dashboard="$(curl -Is localhost/admin/)" # Same logic applies to the dashboard as above, if the X-Header matches what a working system should have, if [[ $dashboard == "$dashboard_working" ]]; then @@ -812,6 +812,7 @@ check_x_headers() { else # Otherwise, it's a failure since the X-Headers either don't exist or have been modified in some way log_write "$CROSS Web interface X-Header: ${COL_RED}X-Header does not match or could not be retrieved.${COL_NC}" + log_write "${COL_RED}${full_curl_output_dashboard}${COL_NC}" fi } |