Skip to content

Commit

Permalink
feat: 远程下载文件忽略证书 (#3188)
Browse files Browse the repository at this point in the history
Refs #2950
  • Loading branch information
zhengkunwang223 authored Dec 5, 2023
1 parent 5f9073c commit 592a1b1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 6 additions & 1 deletion backend/utils/files/file_op.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"archive/zip"
"bufio"
"context"
"crypto/tls"
"encoding/json"
"fmt"
"github.com/1Panel-dev/1Panel/backend/utils/cmd"
Expand Down Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions backend/utils/http/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package http

import (
"context"
"crypto/tls"
"errors"
"github.com/1Panel-dev/1Panel/backend/buserr"
"net"
Expand All @@ -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,
Expand Down

0 comments on commit 592a1b1

Please sign in to comment.