Skip to content
Myr

32 << 10 != 32 Mb (#1094)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by George Kirilenko · committed by Bo-Yi Wu · parent ab50cf9 · Browse files · 1 file+4 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+4 added−2 removed

  • other:+4 added−2 removed

1 file+4 added−2 removed

modified:binding/form.go+4 added-2 removed
4 unmodified lines
5package binding67import "net/http"89const defaultMemory = 32 * 1024 * 10241011type formBinding struct{}12type formPostBinding struct{}13type formMultipartBinding struct{}14
4 unmodified lines
19func (formBinding) Bind(req *http.Request, obj interface{}) error {20 if err := req.ParseForm(); err != nil {21 return err22 }21 req.ParseMultipartForm(32 << 10) // 32 MB23 req.ParseMultipartForm(defaultMemory)24 if err := mapForm(obj, req.Form); err != nil {25 return err26 }27 return validate(obj)
17 unmodified lines
45 return "multipart/form-data"46}4748func (formMultipartBinding) Bind(req *http.Request, obj interface{}) error {47 if err := req.ParseMultipartForm(32 << 10); err != nil {49 if err := req.ParseMultipartForm(defaultMemory); err != nil {50 return err51 }52 if err := mapForm(obj, req.MultipartForm.Value); err != nil {53 return err
3 unmodified lines