mirror of
https://github.com/vdsm/virtual-dsm.git
synced 2025-02-24 13:30:02 +08:00
fix: Set request header
This commit is contained in:
parent
b88207f0dd
commit
2cf4ca07f4
@ -34,7 +34,7 @@ if [ -z "$DL" ]; then
|
|||||||
info "Install: Selecting download mirror..."
|
info "Install: Selecting download mirror..."
|
||||||
|
|
||||||
# Detect country
|
# Detect country
|
||||||
{ JSON=$(curl -sfk https://ipinfo.io/json); rc=$?; } || :
|
{ JSON=$(curl -H "Accept: application/json" -sfk https://ipinfo.io/json); rc=$?; } || :
|
||||||
|
|
||||||
if (( rc == 0 )); then
|
if (( rc == 0 )); then
|
||||||
{ COUNTRY=$(echo "$JSON" | jq -r '.country' 2> /dev/null); rc=$?; } || :
|
{ COUNTRY=$(echo "$JSON" | jq -r '.country' 2> /dev/null); rc=$?; } || :
|
||||||
@ -42,7 +42,7 @@ if [ -z "$DL" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -z "$COUNTRY" ]]; then
|
if [[ -z "$COUNTRY" ]]; then
|
||||||
{ JSON=$(curl -sfk https://api.ipapi.is); rc=$?; } || :
|
{ JSON=$(curl -H "Accept: application/json" -sfk https://api.ipapi.is); rc=$?; } || :
|
||||||
if (( rc == 0 )); then
|
if (( rc == 0 )); then
|
||||||
{ COUNTRY=$(echo "$JSON" | jq -r '.location.country_code' 2> /dev/null); rc=$?; } || :
|
{ COUNTRY=$(echo "$JSON" | jq -r '.location.country_code' 2> /dev/null); rc=$?; } || :
|
||||||
(( rc != 0 )) || [[ "$COUNTRY" == "null" ]] && COUNTRY=""
|
(( rc != 0 )) || [[ "$COUNTRY" == "null" ]] && COUNTRY=""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user