From 899f2853191ecd3cf21d93d602e5719fa578b1c4 Mon Sep 17 00:00:00 2001 From: Anthony Rusdi <33247310+antrusd@users.noreply.github.com> Date: Sat, 21 Sep 2019 08:30:45 +0700 Subject: [PATCH] s3: fix signature v2_auth headers When used with v2_auth = true, PresignRequest doesn't return signed headers, so remote dest authentication would be fail. This commit copying back HTTPRequest.Header to headers. Tested with RiakCS v2.1.0. Signed-off-by: Anthony Rusdi <33247310+antrusd@users.noreply.github.com> --- backend/s3/s3.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/backend/s3/s3.go b/backend/s3/s3.go index edbe3bb68..dbc6f72af 100644 --- a/backend/s3/s3.go +++ b/backend/s3/s3.go @@ -1925,6 +1925,10 @@ func (o *Object) Update(ctx context.Context, in io.Reader, src fs.ObjectInfo, op return errors.Wrap(err, "s3 upload: sign request") } + if o.fs.opt.V2Auth && headers == nil { + headers = putObj.HTTPRequest.Header + } + // Set request to nil if empty so as not to make chunked encoding if size == 0 { in = nil