mirror of
https://github.com/gin-gonic/gin.git
synced 2025-04-06 03:57:46 +08:00
Trea http.ErrAbortHandler as broken pipe
``` ErrAbortHandler is a sentinel panic value to abort a handler. While any panic from ServeHTTP aborts the response to the client, panicking with ErrAbortHandler also suppresses logging of a stack trace to the server's error log. ``` - CC - #1714 - similar to https://github.com/gorilla/handlers/pull/159/files - Other PR: https://github.com/gin-gonic/gin/pull/2590
This commit is contained in:
parent
c5fd06361b
commit
d2415e54db
@ -69,6 +69,9 @@ func CustomRecoveryWithWriter(out io.Writer, handle RecoveryFunc) HandlerFunc {
|
||||
}
|
||||
}
|
||||
}
|
||||
if errors.Is(err, http.ErrAbortHandler) {
|
||||
brokenPipe = true
|
||||
}
|
||||
if logger != nil {
|
||||
stack := stack(3)
|
||||
httpRequest, _ := httputil.DumpRequest(c.Request, false)
|
||||
|
Loading…
x
Reference in New Issue
Block a user