do not generate http status 502 for canceled http requests

do log them with level debug, and print the error in the http access log line.
This commit is contained in:
Mechiel Lukkien
2023-03-21 09:25:49 +01:00
parent f531a9bf35
commit 00ea31f2f6
2 changed files with 10 additions and 1 deletions

View File

@ -152,7 +152,11 @@ func (w *loggingWriter) Done() {
tlsinfo = "(other)"
}
}
xlog.WithContext(w.R.Context()).Debugx("http request", w.WriteErr,
err := w.WriteErr
if err == nil {
err = w.R.Context().Err()
}
xlog.WithContext(w.R.Context()).Debugx("http request", err,
mlog.Field("httpaccess", ""),
mlog.Field("handler", w.Handler),
mlog.Field("method", method),