"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files
Go azure-blobazure-blob-storageazure-filesbackblaze-b2cloud-storagedropboxencryptionftpfuse-filesystemgogolanggoogle-cloud-storagegoogle-driveonedriveopenstack-swiftrclones3sftpsyncwebdav
putio: make downloading files use the rclone http Client
Nick Craig-Wood7c98ecd3ab93
diff --git a/backend/putio/fs.go b/backend/putio/fs.goindex 37800e411..6003007ad 100644--- a/backend/putio/fs.go+++ b/backend/putio/fs.go@@ -18,6 +18,7 @@ import ("github.com/rclone/rclone/fs""github.com/rclone/rclone/fs/config/configmap""github.com/rclone/rclone/fs/config/configstruct"+ "github.com/rclone/rclone/fs/fshttp""github.com/rclone/rclone/fs/hash""github.com/rclone/rclone/lib/dircache""github.com/rclone/rclone/lib/oauthutil"@@ -34,7 +35,8 @@ type Fs struct {client *putio.Client // client for making API calls to Put.iopacer *fs.Pacer // To pace the API callsdirCache *dircache.DirCache // Map of directory path to directory id- oAuthClient *http.Client+ httpClient *http.Client // base http client+ oAuthClient *http.Client // http client with oauth Authorization}// ------------------------------------------------------------@@ -68,7 +70,8 @@ func NewFs(name, root string, m configmap.Mapper) (f fs.Fs, err error) {if err != nil {return nil, err}- oAuthClient, _, err := oauthutil.NewClient(name, m, putioConfig)+ httpClient := fshttp.NewClient(fs.Config)+ oAuthClient, _, err := oauthutil.NewClientWithBaseClient(name, m, putioConfig, httpClient)if err != nil {return nil, errors.Wrap(err, "failed to configure putio")}@@ -78,6 +81,7 @@ func NewFs(name, root string, m configmap.Mapper) (f fs.Fs, err error) {opt: *opt,pacer: fs.NewPacer(pacer.NewDefault(pacer.MinSleep(minSleep), pacer.MaxSleep(maxSleep), pacer.DecayConstant(decayConstant))),client: putio.NewClient(oAuthClient),+ httpClient: httpClient,oAuthClient: oAuthClient,}p.features = (&fs.Features{diff --git a/backend/putio/object.go b/backend/putio/object.goindex fb6efb220..27723532b 100644--- a/backend/putio/object.go+++ b/backend/putio/object.go@@ -241,7 +241,7 @@ func (o *Object) Open(ctx context.Context, options ...fs.OpenOption) (in io.Readreq.Header.Set(header, value)}// fs.Debugf(o, "opening file: id=%d", o.file.ID)- resp, err = http.DefaultClient.Do(req)+ resp, err = o.fs.httpClient.Do(req)return shouldRetry(err)})if perr, ok := err.(*putio.ErrorResponse); ok && perr.Response.StatusCode >= 400 && perr.Response.StatusCode <= 499 {