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:
adshield-joon 2023-02-02 15:31:58 -05:00 committed by GitHub
parent c5fd06361b
commit d2415e54db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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)