From ad9f242016a620352e3d70b9e591cdcbc7441202 Mon Sep 17 00:00:00 2001 From: yangwei999 <348134071@qq.com> Date: Tue, 29 Aug 2023 19:41:08 +0800 Subject: [PATCH] fix bug --- cve-vulner-manager/conf/product_app.conf | 2 +- cve-vulner-manager/cve-timed-task/util/crawl.go | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/cve-vulner-manager/conf/product_app.conf b/cve-vulner-manager/conf/product_app.conf index 2711e78..a66e8bf 100644 --- a/cve-vulner-manager/conf/product_app.conf +++ b/cve-vulner-manager/conf/product_app.conf @@ -93,7 +93,7 @@ genexcelflag = 1 genexcel = 0 15 15 * * * days = -30 prcnum = 50 -printlogflag = 1 +printlogflag = 2 printlog = 0 0 1 * * 2,4,6 unlockflag = 1 unlock = 0 */5 * * * * diff --git a/cve-vulner-manager/cve-timed-task/util/crawl.go b/cve-vulner-manager/cve-timed-task/util/crawl.go index 71af4ef..81a87cc 100644 --- a/cve-vulner-manager/cve-timed-task/util/crawl.go +++ b/cve-vulner-manager/cve-timed-task/util/crawl.go @@ -1,18 +1,20 @@ package util import ( + "net/http" + "github.com/pkg/errors" "golang.org/x/net/html" "golang.org/x/net/html/charset" - "net/http" ) func UrlToHTML(url string) (*html.Node, error) { resp, err := http.Get(url) - defer resp.Body.Close() - if err != nil { + if err != nil || resp == nil { return nil, err } + defer resp.Body.Close() + if resp.StatusCode != http.StatusOK { return nil, errors.New(resp.Status) } -- Gitee