From 592a1b1150d1433cba87bd8e89f611b3f96d3bca Mon Sep 17 00:00:00 2001 From: zhengkunwang <31820853+zhengkunwang223@users.noreply.github.com> Date: Tue, 5 Dec 2023 16:30:10 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=BF=9C=E7=A8=8B=E4=B8=8B=E8=BD=BD?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E5=BF=BD=E7=95=A5=E8=AF=81=E4=B9=A6=20(#3188?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Refs https://github.com/1Panel-dev/1Panel/issues/2950 --- backend/utils/files/file_op.go | 7 ++++++- backend/utils/http/get.go | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/backend/utils/files/file_op.go b/backend/utils/files/file_op.go index b2aec83e2..6860abc54 100644 --- a/backend/utils/files/file_op.go +++ b/backend/utils/files/file_op.go @@ -4,6 +4,7 @@ import ( "archive/zip" "bufio" "context" + "crypto/tls" "encoding/json" "fmt" "github.com/1Panel-dev/1Panel/backend/utils/cmd" @@ -216,7 +217,11 @@ func (w *WriteCounter) SaveProcess() { } func (f FileOp) DownloadFileWithProcess(url, dst, key string) error { - client := &http.Client{} + client := &http.Client{ + Transport: &http.Transport{ + TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, + }, + } request, err := http.NewRequest("GET", url, nil) if err != nil { return nil diff --git a/backend/utils/http/get.go b/backend/utils/http/get.go index 223a05093..bacdc865c 100644 --- a/backend/utils/http/get.go +++ b/backend/utils/http/get.go @@ -2,6 +2,7 @@ package http import ( "context" + "crypto/tls" "errors" "github.com/1Panel-dev/1Panel/backend/buserr" "net" @@ -14,6 +15,7 @@ func GetHttpRes(url string) (*http.Response, error) { client := &http.Client{ Timeout: time.Second * 300, Transport: &http.Transport{ + TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, DialContext: (&net.Dialer{ Timeout: 60 * time.Second, KeepAlive: 60 * time.Second,