forked from TrueCloudLab/rclone
koofr: use rclone HTTP client.
This commit is contained in:
parent
2784c3234b
commit
acefa5c40d
1 changed files with 4 additions and 1 deletions
|
@ -16,6 +16,7 @@ import (
|
||||||
"github.com/rclone/rclone/fs/config/configstruct"
|
"github.com/rclone/rclone/fs/config/configstruct"
|
||||||
"github.com/rclone/rclone/fs/config/obscure"
|
"github.com/rclone/rclone/fs/config/obscure"
|
||||||
"github.com/rclone/rclone/fs/encodings"
|
"github.com/rclone/rclone/fs/encodings"
|
||||||
|
"github.com/rclone/rclone/fs/fshttp"
|
||||||
"github.com/rclone/rclone/fs/hash"
|
"github.com/rclone/rclone/fs/hash"
|
||||||
|
|
||||||
httpclient "github.com/koofr/go-httpclient"
|
httpclient "github.com/koofr/go-httpclient"
|
||||||
|
@ -259,7 +260,9 @@ func NewFs(name, root string, m configmap.Mapper) (ff fs.Fs, err error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
client := koofrclient.NewKoofrClient(opt.Endpoint, false)
|
httpClient := httpclient.New()
|
||||||
|
httpClient.Client = fshttp.NewClient(fs.Config)
|
||||||
|
client := koofrclient.NewKoofrClientWithHTTPClient(opt.Endpoint, httpClient)
|
||||||
basicAuth := fmt.Sprintf("Basic %s",
|
basicAuth := fmt.Sprintf("Basic %s",
|
||||||
base64.StdEncoding.EncodeToString([]byte(opt.User+":"+pass)))
|
base64.StdEncoding.EncodeToString([]byte(opt.User+":"+pass)))
|
||||||
client.HTTPClient.Headers.Set("Authorization", basicAuth)
|
client.HTTPClient.Headers.Set("Authorization", basicAuth)
|
||||||
|
|
Loading…
Reference in a new issue