Object payload transferred in chunks. Size of the
chunks may be limited by transport protocols. To
split it we use `io.CopyBuffer` with pre-allocated
buffer size of one chunk. However this function may
ignore buffer if reader or writer implements
`WriteTo` or `ReadFrom` methods. Unfortunately
`bytes.Reader` implements `WriteTo` function.
To fix this we wrap reader so wrapper implements
only `io.Reader` interface.
Related to github.com/nspcc-dev/neofs-node/issues/338
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
Make Client.GetContainer method to return an error if received container
structure does not meet NeoFS API specification.
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
GetContainer method reads container structure by identifier from the
network. In some cases it is required to additionally check the
correspondence of the container structure to the identifier as a hash from
the binary representation. To do this, a new function
GetVerifiedContainerStructure is defined to execute the check after
receiving the container.
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
GetEACL method of Client receives eACL table with signature, verifies the
signature and return the table. In some cases we need to receive table and
signature regardless of their correctness. New method GetEACLWithSignature
provides such an opportunity.
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
Extended ACL tables should be signed with RFC-6979 standard. Fix Client
.GetEACL implementation to verify eACL signature with SignRFC6979 option.
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
There is a need to set dial timeout in SDK client that is used in case of
internal connection opening. Add DialTimeout option constructor to support
this feature.
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
According to API object.Head response contains signature of
object ID rather than signature of object header itself.
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
In some cases SDK Client provided with signed and prepared
session token. In this case we don't need to change verb
or sign it.
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
There is a issue when user sends payload chunk to the neofs
node, but node closes connection earlier, e.g. node can return
error as soon as it checked ACL permission and denied request.
In this case client will receive EOF error and it produces
`could not send payload bytes to Put object stream` error, but
in fact there is different error.
If we ignore EOF there then `stream.CloseAndRecv()` return
correct error message later.
Signed-off-by: Alex Vanin <alexey@nspcc.ru>