mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-11-29 01:23:18 +00:00
We do not follow 308 but FTL also doesn't suggest it
Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
parent
96bf07863f
commit
32a741b5c7
1 changed files with 4 additions and 7 deletions
|
@ -25,7 +25,7 @@ TestAPIAvailability() {
|
||||||
|
|
||||||
# Query the API URLs from FTL using CHAOS TXT local.api.ftl
|
# Query the API URLs from FTL using CHAOS TXT local.api.ftl
|
||||||
# The result is a space-separated enumeration of full URLs
|
# The result is a space-separated enumeration of full URLs
|
||||||
# e.g., "http://localhost:80/api" "https://localhost:443/api"
|
# e.g., "http://localhost:80/api/" "https://localhost:443/api/"
|
||||||
chaos_api_list="$(dig +short chaos txt local.api.ftl @127.0.0.1)"
|
chaos_api_list="$(dig +short chaos txt local.api.ftl @127.0.0.1)"
|
||||||
|
|
||||||
# If the query was not successful, the variable is empty
|
# If the query was not successful, the variable is empty
|
||||||
|
@ -45,8 +45,8 @@ TestAPIAvailability() {
|
||||||
# Test if the API is available at this URL
|
# Test if the API is available at this URL
|
||||||
availabilityResonse=$(curl -skS -o /dev/null -w "%{http_code}" "${API_URL}auth")
|
availabilityResonse=$(curl -skS -o /dev/null -w "%{http_code}" "${API_URL}auth")
|
||||||
|
|
||||||
# Test if http status code was 200 (OK), 308 (redirect, we follow) 401 (authentication required)
|
# Test if http status code was 200 (OK) or 401 (authentication required)
|
||||||
if [ ! "${availabilityResonse}" = 200 ] && [ ! "${availabilityResonse}" = 308 ] && [ ! "${availabilityResonse}" = 401 ]; then
|
if [ ! "${availabilityResonse}" = 200 ] && [ ! "${availabilityResonse}" = 401 ]; then
|
||||||
# API is not available at this port/protocol combination
|
# API is not available at this port/protocol combination
|
||||||
API_PORT=""
|
API_PORT=""
|
||||||
else
|
else
|
||||||
|
@ -131,7 +131,7 @@ GetFTLData() {
|
||||||
# data is everything from response without the last 3 characters
|
# data is everything from response without the last 3 characters
|
||||||
data=$(printf %s "${response%???}")
|
data=$(printf %s "${response%???}")
|
||||||
|
|
||||||
if [ "${status}" = 200 ] || [ "${status}" = 308 ]; then
|
if [ "${status}" = 200 ]; then
|
||||||
# response OK
|
# response OK
|
||||||
echo "${data}"
|
echo "${data}"
|
||||||
elif [ "${status}" = 000 ]; then
|
elif [ "${status}" = 000 ]; then
|
||||||
|
@ -193,6 +193,3 @@ secretRead() {
|
||||||
# restore original terminal settings
|
# restore original terminal settings
|
||||||
stty "${stty_orig}"
|
stty "${stty_orig}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TestAPIAvailability
|
|
||||||
|
|
Loading…
Reference in a new issue