core: Remove TCP details from connection reset message

This commit is contained in:
Marius 2019-07-21 22:40:41 +02:00
parent 85a26150a3
commit 8242b4dfb5
1 changed files with 7 additions and 0 deletions

View File

@ -815,6 +815,13 @@ func (handler *UnroutedHandler) sendError(w http.ResponseWriter, r *http.Request
err = errors.New("read tcp: i/o timeout") err = errors.New("read tcp: i/o timeout")
} }
// Errors for connnection resets also contain TCP details, we don't need, e.g:
// read tcp 127.0.0.1:1080->127.0.0.1:10023: read: connection reset by peer
// Therefore, we also trim those down.
if strings.HasSuffix(err.Error(), "read: connection reset by peer") {
err = errors.New("read tcp: connection reset by peer")
}
statusErr, ok := err.(HTTPError) statusErr, ok := err.(HTTPError)
if !ok { if !ok {
statusErr = NewHTTPError(err, http.StatusInternalServerError) statusErr = NewHTTPError(err, http.StatusInternalServerError)