1
0
mirror of https://github.com/astaxie/beego.git synced 2025-08-31 00:57:32 +00:00

fix: response http 413 when body size larger then MaxMemory.

This commit is contained in:
Chenrui
2020-07-08 17:14:52 +08:00
parent bac2b31afe
commit 946a42c021
2 changed files with 29 additions and 4 deletions

View File

@@ -707,6 +707,10 @@ func (p *ControllerRegister) ServeHTTP(rw http.ResponseWriter, r *http.Request)
if r.Method != http.MethodGet && r.Method != http.MethodHead {
if BConfig.CopyRequestBody && !context.Input.IsUpload() {
if r.ContentLength > BConfig.MaxMemory {
exception("413", context)
goto Admin
}
context.Input.CopyBody(BConfig.MaxMemory)
}
context.Input.ParseFormOrMulitForm(BConfig.MaxMemory)