Fixes after review

After discussion, we decided to simplify attribute translation for now. Full translation requires support for UTF-8 values encoded according to RFC 8187/7230, this can be clarified and implemented in further PRs.

1. Remove translation tables
2. Use simple translation rules only, for now ignoring UTF-8 keys and values

- `X-Attribute-NEOFS-` prefixed headers considered well-known system attributes
- System Attribute key is uppercased
- System Attribute key's `-` translates to `_`
- `X-Attribute-` prefixed headers considered regular object attributes
- Normal attribute key is a result of http header prefix trimming
- Value string should be left as is, for now

```
HTTP:
X-Attribute-NEOFS-Expiration-Epoch: 123
X-Attribute-FileName: cat.jpg

NeoFS:
__NEOFS__EXPIRATION_EPOCH: "123"
FileName: "cat.jpg"
```

Signed-off-by: Evgeniy Kulikov <kim@nspcc.ru>
This commit is contained in:
Evgeniy Kulikov 2021-02-03 16:01:30 +03:00
parent 71999a796d
commit cbaf9e6142
No known key found for this signature in database
GPG key ID: BF6AEE0A2A699BF2
5 changed files with 30 additions and 83 deletions

4
app.go
View file

@ -26,8 +26,6 @@ type (
cfg *viper.Viper
key *ecdsa.PrivateKey
hdr HeaderFilter
wlog logger.Logger
web *fasthttp.Server
@ -78,8 +76,6 @@ func newApp(ctx context.Context, opt ...Option) App {
opt[i](a)
}
a.hdr = newHeaderFilter(a.log, a.cfg)
a.enableDefaultTimestamp = a.cfg.GetBool(cfgUploaderHeaderEnableDefaultTimestamp)
a.wlog = logger.GRPC(a.log)