"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
rest: don't canonicalise headers starting with `*`
Nick Craig-Wood65071599a201
diff --git a/lib/rest/rest.go b/lib/rest/rest.goindex 0cdccf028..e4cd74cef 100644--- a/lib/rest/rest.go+++ b/lib/rest/rest.go@@ -75,6 +75,7 @@ func (api *Client) SetRoot(RootURL string) *Client {}// SetHeader sets a header for all requests+// Start the key with "*" for don't canonicalisefunc (api *Client) SetHeader(key, value string) *Client {api.mu.Lock()defer api.mu.Unlock()@@ -133,9 +134,9 @@ type Opts struct {ContentType stringContentLength *int64ContentRange string- ExtraHeaders map[string]string- UserName string // username for Basic Auth- Password string // password for Basic Auth+ ExtraHeaders map[string]string // extra headers, start them with "*" for don't canonicalise+ UserName string // username for Basic Auth+ Password string // password for Basic AuthOptions []fs.OpenOptionIgnoreStatus bool // if set then we don't check error status or parse error bodyMultipartParams url.Values // if set do multipart form upload with attached file@@ -247,10 +248,17 @@ func (api *Client) Call(ctx context.Context, opts *Opts) (resp *http.Response, efs.OpenOptionAddHeaders(opts.Options, headers)// Now set the headersfor k, v := range headers {- if v != "" {- req.Header.Add(k, v)+ if k != "" && v != "" {+ if k[0] == '*' {+ // Add non-canonical version if header starts with *+ k = k[1:]+ req.Header[k] = append(req.Header[k], v)+ } else {+ req.Header.Add(k, v)+ }}}+if opts.UserName != "" || opts.Password != "" {req.SetBasicAuth(opts.UserName, opts.Password)}