Improved url online checking logic (#10206)

Improved url online checking logic. When 401 is returned, it can also be recognized as online
This commit is contained in:
pinghe 2024-01-17 16:48:51 +08:00 committed by GitHub
parent 540af4051b
commit 9c703d0016
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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
}