[BUG] Serious questions about iris.withpostmaxmemory and iris.limitrequestbodysize,The connection was not disconnected when the uploaded file exceeded its capacity
- Dominant language
- Go
- Stars
- 25.6k
- Forks
- 2.4k
- PR merge metrics
- No merged PRs in 30d
Description
platform: window10
go version: go1.16.6 windows/amd64
iris version: github.com/kataras/iris/v12@v12.2.0
upload file size: 1G
See the notes below
Step 1:
app := iris.New()
app.Run(
iris.Addr(fmt.Sprintf("%s:%d", "127.0.0.1", 8081)),
iris.WithoutServerError(iris.ErrServerClosed),
iris.WithOptimizations,
iris.WithTimeFormat(time.RFC3339),
// Set WithPostMaxMemory 8M
iris.WithPostMaxMemory(8 << 20),
);
Step 2:
// iris.LimitRequestBodySize
//[BUG] There was no response and the connection was not disconnected
app.Post("/upload", iris.LimitRequestBodySize(8<<20), func (ctx iris.Context) {
// ...
})
or
app.Post("/upload", iris.LimitRequestBodySize(8<<20), func (ctx iris.Context) {
maxSize := 8 << 20
if ctx.GetContentLength() > maxSize {
//[BUG] There was no response and the connection was not disconnected
ctx.StopWithStatus(iris.StatusRequestEntityTooLarge)
return
}
ctx.Next()
})
Contributor guide
Assessment
This issue has not been assessed yet.