mirror of
https://github.com/caddyserver/caddy.git
synced 2025-10-19 15:53:17 +00:00
requestbody: Return HTTP 413 (fix #4558)
This commit is contained in:
parent
b82e22b459
commit
3d616e8c6d
4 changed files with 25 additions and 8 deletions
|
@ -17,6 +17,7 @@ package caddyhttp
|
|||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net"
|
||||
"net/http"
|
||||
|
@ -600,7 +601,8 @@ func PrepareRequest(r *http.Request, repl *caddy.Replacer, w http.ResponseWriter
|
|||
// If err is a HandlerError, the returned values will
|
||||
// have richer information.
|
||||
func errLogValues(err error) (status int, msg string, fields []zapcore.Field) {
|
||||
if handlerErr, ok := err.(HandlerError); ok {
|
||||
var handlerErr HandlerError
|
||||
if errors.As(err, &handlerErr) {
|
||||
status = handlerErr.StatusCode
|
||||
if handlerErr.Err == nil {
|
||||
msg = err.Error()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue