[#285] object/put: Fix the loss of X-headers when forwarding objects

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2020-12-29 11:24:07 +03:00 committed by Alex Vanin
parent 2897e83fb2
commit 1dd1762163
2 changed files with 7 additions and 10 deletions

View file

@ -4,7 +4,6 @@ import (
"context" "context"
"github.com/nspcc-dev/neofs-api-go/pkg/client" "github.com/nspcc-dev/neofs-api-go/pkg/client"
"github.com/nspcc-dev/neofs-api-go/pkg/token"
"github.com/nspcc-dev/neofs-node/pkg/core/object" "github.com/nspcc-dev/neofs-node/pkg/core/object"
"github.com/nspcc-dev/neofs-node/pkg/network" "github.com/nspcc-dev/neofs-node/pkg/network"
"github.com/nspcc-dev/neofs-node/pkg/network/cache" "github.com/nspcc-dev/neofs-node/pkg/network/cache"
@ -20,9 +19,7 @@ type remoteTarget struct {
keyStorage *util.KeyStorage keyStorage *util.KeyStorage
token *token.SessionToken commonPrm *util.CommonPrm
bearer *token.BearerToken
addr *network.Address addr *network.Address
@ -57,7 +54,7 @@ func (t *remoteTarget) WriteHeader(obj *object.RawObject) error {
} }
func (t *remoteTarget) Close() (*transformer.AccessIdentifiers, error) { func (t *remoteTarget) Close() (*transformer.AccessIdentifiers, error) {
key, err := t.keyStorage.GetKey(t.token) key, err := t.keyStorage.GetKey(t.commonPrm.SessionToken())
if err != nil { if err != nil {
return nil, errors.Wrapf(err, "(%T) could not receive private key", t) return nil, errors.Wrapf(err, "(%T) could not receive private key", t)
} }
@ -76,9 +73,10 @@ func (t *remoteTarget) Close() (*transformer.AccessIdentifiers, error) {
WithObject( WithObject(
t.obj.SDK(), t.obj.SDK(),
), ),
append(
t.commonPrm.RemoteCallOptions(),
client.WithTTL(1), // FIXME: use constant client.WithTTL(1), // FIXME: use constant
client.WithBearer(t.bearer), )...,
client.WithSession(t.token),
) )
if err != nil { if err != nil {
return nil, errors.Wrapf(err, "(%T) could not put object to %s", t, addr) return nil, errors.Wrapf(err, "(%T) could not put object to %s", t, addr)

View file

@ -140,8 +140,7 @@ func (p *Streamer) newCommonTarget(prm *PutInitPrm) transformer.ObjectTarget {
return &remoteTarget{ return &remoteTarget{
ctx: p.ctx, ctx: p.ctx,
keyStorage: p.keyStorage, keyStorage: p.keyStorage,
token: prm.common.SessionToken(), commonPrm: prm.common,
bearer: prm.common.BearerToken(),
addr: addr, addr: addr,
clientCache: p.clientCache, clientCache: p.clientCache,
clientOpts: p.clientOpts, clientOpts: p.clientOpts,