From b77186f8033c72e2533195dd2d93ea68a9f1eb3b Mon Sep 17 00:00:00 2001 From: Matrix Zou Date: Thu, 30 May 2024 11:46:53 +0400 Subject: [PATCH 1/3] Fix segment wan_ip * 302 (redirect) response from Akamai. Fix with option `-L` follow redirect. --- segments/wan_ip.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/segments/wan_ip.sh b/segments/wan_ip.sh index 1287d5de..9ba380a0 100755 --- a/segments/wan_ip.sh +++ b/segments/wan_ip.sh @@ -39,7 +39,7 @@ run_segment() { fi if [ -z "$wan_ip" ]; then - if wan_ip=$(curl --max-time 2 -s http://whatismyip.akamai.com/); then + if wan_ip=$(curl --max-time 2 -s -L http://whatismyip.akamai.com/); then echo "${wan_ip}" >"$tmp_file" elif [ -f "${tmp_file}" ]; then wan_ip=$(cat "$tmp_file") From a8ac60ab800005767caf3c0a27e9bdbf6083b717 Mon Sep 17 00:00:00 2001 From: Matrix Zou Date: Fri, 31 May 2024 11:15:49 +0400 Subject: [PATCH 2/3] Fix segment wan_ip * 302 (redirect) response from Akamai while using HTTP. Fix with `-L` follow redirect. * Use `HTTPS` instead of `HTTP` enhance security, and avoid 2 requests to be made. --- segments/wan_ip.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/segments/wan_ip.sh b/segments/wan_ip.sh index 9ba380a0..4bd3e698 100755 --- a/segments/wan_ip.sh +++ b/segments/wan_ip.sh @@ -39,7 +39,7 @@ run_segment() { fi if [ -z "$wan_ip" ]; then - if wan_ip=$(curl --max-time 2 -s -L http://whatismyip.akamai.com/); then + if wan_ip=$(curl --max-time 2 -s -L https://whatismyip.akamai.com/); then echo "${wan_ip}" >"$tmp_file" elif [ -f "${tmp_file}" ]; then wan_ip=$(cat "$tmp_file") From bf97f466c510e34a6cd6ecddc420d511aa50dbf9 Mon Sep 17 00:00:00 2001 From: Matrix Zou Date: Fri, 31 May 2024 13:12:04 +0400 Subject: [PATCH 3/3] Fix segment wan-ip * Fix protocal error for wan-ip url, change from `http` to `https` --- segments/wan_ip.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/segments/wan_ip.sh b/segments/wan_ip.sh index 4bd3e698..75647f4b 100755 --- a/segments/wan_ip.sh +++ b/segments/wan_ip.sh @@ -39,7 +39,7 @@ run_segment() { fi if [ -z "$wan_ip" ]; then - if wan_ip=$(curl --max-time 2 -s -L https://whatismyip.akamai.com/); then + if wan_ip=$(curl --max-time 2 -s https://whatismyip.akamai.com/); then echo "${wan_ip}" >"$tmp_file" elif [ -f "${tmp_file}" ]; then wan_ip=$(cat "$tmp_file")