mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-11-15 02:42:58 +00:00
Only do one curl call in debug when checking the X-Header
Signed-off-by: Christian König <ckoenig@posteo.de>
This commit is contained in:
parent
6c9bd7a632
commit
b98e331375
1 changed files with 4 additions and 3 deletions
|
@ -797,13 +797,13 @@ check_x_headers() {
|
||||||
# server is operating correctly
|
# server is operating correctly
|
||||||
echo_current_diagnostic "Dashboard and block page"
|
echo_current_diagnostic "Dashboard and block page"
|
||||||
# Use curl -I to get the header and parse out just the X-Pi-hole one
|
# Use curl -I to get the header and parse out just the X-Pi-hole one
|
||||||
|
local full_curl_output_dashboard
|
||||||
local 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
|
# Store what the X-Header should be in variables for comparison later
|
||||||
local dashboard_working
|
local dashboard_working
|
||||||
dashboard_working="X-Pi-hole: The Pi-hole Web interface is 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,
|
# Same logic applies to the dashboard as above, if the X-Header matches what a working system should have,
|
||||||
if [[ $dashboard == "$dashboard_working" ]]; then
|
if [[ $dashboard == "$dashboard_working" ]]; then
|
||||||
|
@ -812,6 +812,7 @@ check_x_headers() {
|
||||||
else
|
else
|
||||||
# Otherwise, it's a failure since the X-Headers either don't exist or have been modified in some way
|
# 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 "$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}"
|
log_write "${COL_RED}${full_curl_output_dashboard}${COL_NC}"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue