mirror of
https://github.com/astaxie/beego.git
synced 2025-08-31 00:47:33 +00:00
Merge pull request #4058 from a631807682/fix/issues/4054
Fix response payload too large
This commit is contained in:
@@ -742,6 +742,12 @@ 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() {
|
||||
// connection will close if the incoming data are larger (RFC 7231, 6.5.11)
|
||||
if r.ContentLength > BConfig.MaxMemory {
|
||||
logs.Error(errors.New("payload too large"))
|
||||
exception("413", context)
|
||||
goto Admin
|
||||
}
|
||||
context.Input.CopyBody(BConfig.MaxMemory)
|
||||
}
|
||||
context.Input.ParseFormOrMulitForm(BConfig.MaxMemory)
|
||||
|
Reference in New Issue
Block a user