"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
lib/rest: add CheckRedirect function for redirect management
Nick Craig-Wood09cc8179cc23
diff --git a/lib/rest/rest.go b/lib/rest/rest.goindex a7bba472b..61522577d 100644--- a/lib/rest/rest.go+++ b/lib/rest/rest.go@@ -149,6 +149,8 @@ type Opts struct {Trailer *http.Header // set the request trailerClose bool // set to close the connection after this transactionNoRedirect bool // if this is set then the client won't follow redirects+ // On Redirects, call this function - see the http.Client docs: https://pkg.go.dev/net/http#Client+ CheckRedirect func(req *http.Request, via []*http.Request) error}// Copy creates a copy of the options@@ -299,6 +301,10 @@ func (api *Client) Call(ctx context.Context, opts *Opts) (resp *http.Response, evar c *http.Clientif opts.NoRedirect {c = ClientWithNoRedirects(api.c)+ } else if opts.CheckRedirect != nil {+ clientCopy := *api.c+ clientCopy.CheckRedirect = opts.CheckRedirect+ c = &clientCopy} else {c = api.c}