From 0cabf771c9af722e207d8d304498c1d9c47aa986 Mon Sep 17 00:00:00 2001 From: Mmx <1624045573@qq.com> Date: Thu, 2 Dec 2021 22:45:41 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BC=98=E5=8C=96=E7=BD=91=E7=BB=9C?= =?UTF-8?q?=E6=A3=80=E6=9F=A5=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- util/checker.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/util/checker.go b/util/checker.go index 7fb1d67..150bbfe 100644 --- a/util/checker.go +++ b/util/checker.go @@ -11,13 +11,14 @@ var Checker checker // NetOk 网络状况检查 func (checker) NetOk(timeout uint) bool { - h, _, e := tool.HTTP.GetBytes(&tool.GetRequest{ + h, i, e := tool.HTTP.GetReader(&tool.GetRequest{ Url: "https://www.baidu.com/", Redirect: false, Timeout: time.Duration(timeout) * time.Second, }) - if e != nil || h.Get("Location") != "" { + if e != nil { return false } - return true + _ = i.Close() + return h.Get("Location") == "" }