From 8242b4dfb57e8372875e9c7f770ed9eeeabf4333 Mon Sep 17 00:00:00 2001 From: Marius Date: Sun, 21 Jul 2019 22:40:41 +0200 Subject: [PATCH] core: Remove TCP details from connection reset message --- unrouted_handler.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/unrouted_handler.go b/unrouted_handler.go index 1c39841..edd25f9 100644 --- a/unrouted_handler.go +++ b/unrouted_handler.go @@ -815,6 +815,13 @@ func (handler *UnroutedHandler) sendError(w http.ResponseWriter, r *http.Request 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) if !ok { statusErr = NewHTTPError(err, http.StatusInternalServerError)