fix: 更新 DownloadFile 函数以使用自定义 TLS 配置,禁用证书验证以支持不安全连接

This commit is contained in:
lixiangwuxian 2025-04-10 02:21:54 +08:00
parent cc40ea8b3d
commit eafc291a93

View File

@ -2,6 +2,7 @@ package util
import (
"bytes"
"crypto/tls"
"fmt"
"io"
"net/url"
@ -71,7 +72,10 @@ func DownloadFile(urlStr string, dirPath string) (filepath string, err error) {
ReadTimeout: 30 * time.Second,
WriteTimeout: 30 * time.Second,
MaxConnWaitTimeout: 30 * time.Second,
TLSConfig: nil, // 使用默认配置
// TLSConfig: nil, // 使用默认配置
TLSConfig: &tls.Config{
InsecureSkipVerify: true,
},
}
// 准备请求