fix: prevent spurious stack trace with misbehaving clients
See https://github.com/golang/go/commit/9997545a8626bf1a73002f44a7b7538988da4e76 and the previous commit. Co-authored-by: César Gallego Rodríguez <gallego.cesar@gmail.com>
This commit is contained in:
@@ -42,9 +42,7 @@ func getRequestBody(w http.ResponseWriter, r *http.Request, h *model.Handler) {
|
|||||||
if n == 0 {
|
if n == 0 {
|
||||||
httperror.ErrorJSON(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)
|
httperror.ErrorJSON(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)
|
||||||
} else {
|
} else {
|
||||||
// Only way to abort current connection as of go 1.13
|
panic(http.ErrAbortHandler)
|
||||||
// https://github.com/golang/go/issues/16542
|
|
||||||
panic("Truncated body")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user