Set StatusRequestTimeout when net timeout error occurred (#713)

This commit is contained in:
谷月轩
2019-12-31 19:23:27 +08:00
committed by Erik Dubbelboer
parent 958ed36194
commit 16c53d6b04
+2
View File
@@ -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)
}