From 21462e1947abc607df21de0c160a5593b33cbfef Mon Sep 17 00:00:00 2001 From: pinghe Date: Wed, 17 Jan 2024 13:16:05 +0800 Subject: [PATCH] Improved url online checking logic Improved url online checking logic. When 401 is returned, it can also be recognized as online --- kernel/util/net.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/kernel/util/net.go b/kernel/util/net.go index bace9a366f6..f681ffd3cc9 100644 --- a/kernel/util/net.go +++ b/kernel/util/net.go @@ -100,6 +100,11 @@ func isOnline(checkURL string, skipTlsVerify bool) (ret bool) { for i := 0; i < 3; i++ { resp, err := c.R().Get(checkURL) + + if resp.StatusCode == 401 { + return true + } + if resp.GetHeader("Location") != "" { return true }