Introduce limits middleware

1. Replace original `maxrequestbody` directive.
2. Add request header limit.

fix issue #1587

Signed-off-by: Tw <tw19881113@gmail.com>
This commit is contained in:
Tw
2017-05-08 10:36:58 +08:00
parent 90efff68e5
commit ae645ef2e9
11 changed files with 363 additions and 143 deletions
+1 -1
View File
@@ -302,7 +302,7 @@ func (r *replacer) getSubstitution(key string) string {
}
_, err := ioutil.ReadAll(r.request.Body)
if err != nil {
if _, ok := err.(MaxBytesExceeded); ok {
if err == MaxBytesExceededErr {
return r.emptyValue
}
}