From 91f51f17d063809f49e71a8851281785da898242 Mon Sep 17 00:00:00 2001 From: Andy Hsu Date: Fri, 10 Nov 2023 15:38:23 +0800 Subject: [PATCH] feat(webdav): add `tls_insecure_skip_verify` field (close #5490) --- drivers/webdav/meta.go | 1 + drivers/webdav/util.go | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/drivers/webdav/meta.go b/drivers/webdav/meta.go index d66499bc..2294d482 100644 --- a/drivers/webdav/meta.go +++ b/drivers/webdav/meta.go @@ -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{ diff --git a/drivers/webdav/util.go b/drivers/webdav/util.go index 84eebb2e..23dc909f 100644 --- a/drivers/webdav/util.go +++ b/drivers/webdav/util.go @@ -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 {