feat(webdav): support range get

This commit is contained in:
Xhofe
2022-04-23 22:43:02 +08:00
parent 293d574ce7
commit 27b7dae113
26 changed files with 2268 additions and 22 deletions

View File

@ -4,9 +4,8 @@ import (
"github.com/Xhofe/alist/drivers/base"
"github.com/Xhofe/alist/drivers/webdav/odrvcookie"
"github.com/Xhofe/alist/model"
"github.com/Xhofe/alist/pkg/gowebdav"
"github.com/Xhofe/alist/utils"
log "github.com/sirupsen/logrus"
"github.com/studio-b12/gowebdav"
"net/http"
"strings"
)
@ -15,13 +14,10 @@ func (driver WebDav) NewClient(account *model.Account) *gowebdav.Client {
c := gowebdav.NewClient(account.SiteUrl, account.Username, account.Password)
if isSharePoint(account) {
cookie, err := odrvcookie.GetCookie(account.Username, account.Password, account.SiteUrl)
log.Debugln(cookie, err)
if err == nil {
log.Debugln("set interceptor")
c.SetInterceptor(func(method string, rq *http.Request) {
rq.Header.Del("Authorization")
rq.Header.Set("Cookie", cookie)
log.Debugf("sp webdav req: %+v", rq)
})
}
}