Skip to content

Commit

Permalink
Set StatusRequestTimeout when net timeout error occurred (#713)
Browse files Browse the repository at this point in the history
  • Loading branch information
SilverRainZ authored and erikdubbelboer committed Dec 31, 2019
1 parent 958ed36 commit 16c53d6
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions server.go
Original file line number Diff line number Diff line change
Expand Up @@ -2505,6 +2505,8 @@ func (s *Server) writeFastError(w io.Writer, statusCode int, msg string) {
func defaultErrorHandler(ctx *RequestCtx, err error) {
if _, ok := err.(*ErrSmallBuffer); ok {
ctx.Error("Too big request header", StatusRequestHeaderFieldsTooLarge)
} else if netErr, ok := err.(*net.OpError); ok && netErr.Timeout() {
ctx.Error("Request timeout", StatusRequestTimeout)
} else {
ctx.Error("Error when parsing request", StatusBadRequest)
}
Expand Down

0 comments on commit 16c53d6

Please sign in to comment.