Skip to content

Commit

Permalink
feat(webdav): add tls_insecure_skip_verify field (close #5490)
Browse files Browse the repository at this point in the history
  • Loading branch information
xhofe committed Nov 10, 2023
1 parent 4355dae commit 91f51f1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions drivers/webdav/meta.go
Expand Up @@ -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{
Expand Down
5 changes: 5 additions & 0 deletions drivers/webdav/util.go
@@ -1,6 +1,7 @@
package webdav

import (
"crypto/tls"
"net/http"
"net/http/cookiejar"

Expand All @@ -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 {
Expand Down

0 comments on commit 91f51f1

Please sign in to comment.