forked from TrueCloudLab/frostfs-http-gw
Added POST method to upload files into NeoFS through HTTP Gate
- Updated README - Added method to upload files into NeoFS - HTTP Upload Header Filter loaded from settings - Added `HeaderFilter` that filters headers (object attributes) Signed-off-by: Evgeniy Kulikov <kim@nspcc.ru>
This commit is contained in:
parent
67684c5d8a
commit
462de45e12
5 changed files with 257 additions and 3 deletions
8
app.go
8
app.go
|
@ -26,6 +26,8 @@ type (
|
|||
cfg *viper.Viper
|
||||
key *ecdsa.PrivateKey
|
||||
|
||||
hdr HeaderFilter
|
||||
|
||||
wlog logger.Logger
|
||||
web *fasthttp.Server
|
||||
|
||||
|
@ -74,6 +76,8 @@ func newApp(ctx context.Context, opt ...Option) App {
|
|||
opt[i](a)
|
||||
}
|
||||
|
||||
a.hdr = newHeaderFilter(a.log, a.cfg)
|
||||
|
||||
a.wlog = logger.GRPC(a.log)
|
||||
|
||||
if a.cfg.GetBool(cmdVerbose) {
|
||||
|
@ -90,7 +94,6 @@ func newApp(ctx context.Context, opt ...Option) App {
|
|||
a.web.WriteBufferSize = a.cfg.GetInt(cfgWebWriteBufferSize)
|
||||
a.web.ReadTimeout = a.cfg.GetDuration(cfgWebReadTimeout)
|
||||
a.web.WriteTimeout = a.cfg.GetDuration(cfgWebWriteTimeout)
|
||||
a.web.GetOnly = true
|
||||
a.web.DisableHeaderNamesNormalizing = true
|
||||
a.web.NoDefaultServerHeader = true
|
||||
a.web.NoDefaultContentType = true
|
||||
|
@ -174,6 +177,9 @@ func (a *app) Serve(ctx context.Context) {
|
|||
r := router.New()
|
||||
r.RedirectTrailingSlash = true
|
||||
|
||||
a.log.Info("enabled /put/{cid}")
|
||||
r.POST("/put/{cid}", a.upload)
|
||||
|
||||
a.log.Info("enabled /get/{cid}/{oid}")
|
||||
r.GET("/get/{cid}/{oid}", a.byAddress)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue