feat(webdav): add `tls_insecure_skip_verify` field (close #5490)

pull/5503/head
Andy Hsu 2023-11-10 15:38:23 +08:00
parent 4355dae491
commit 91f51f17d0
2 changed files with 6 additions and 0 deletions

View File

@ -11,6 +11,7 @@ type Addition struct {
Username string `json:"username" required:"true"`
Password string `json:"password" required:"true"`
driver.RootPath
TlsInsecureSkipVerify bool `json:"tls_insecure_skip_verify" default:"false"`
}
var config = driver.Config{

View File

@ -1,6 +1,7 @@
package webdav
import (
"crypto/tls"
"net/http"
"net/http/cookiejar"
@ -17,6 +18,10 @@ func (d *WebDav) isSharepoint() bool {
func (d *WebDav) setClient() error {
c := gowebdav.NewClient(d.Address, d.Username, d.Password)
c.SetTransport(&http.Transport{
Proxy: http.ProxyFromEnvironment,
TLSClientConfig: &tls.Config{InsecureSkipVerify: d.TlsInsecureSkipVerify},
})
if d.isSharepoint() {
cookie, err := odrvcookie.GetCookie(d.Username, d.Password, d.Address)
if err == nil {