From ee92df32032e65d2fb0d8946116d7618c3667bb5 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Mon, 29 Aug 2022 13:13:21 +0300 Subject: [PATCH] [#326] client: Sign message in `object.GetRange`' Signed-off-by: Evgenii Stratonikov --- client/object_get.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/client/object_get.go b/client/object_get.go index ea4528d..ee86e38 100644 --- a/client/object_get.go +++ b/client/object_get.go @@ -686,6 +686,16 @@ func (c *Client) ObjectRangeInit(ctx context.Context, prm PrmObjectRange) (*Obje req.SetBody(&body) c.prepareRequest(&req, &prm.meta) + key := prm.key + if key == nil { + key = &c.prm.key + } + + err := signature.SignServiceMessage(key, &req) + if err != nil { + return nil, fmt.Errorf("sign request: %w", err) + } + ctx, cancel := context.WithCancel(ctx) stream, err := rpcapi.GetObjectRange(&c.c, &req, client.WithContext(ctx))