change the log level if hijacking without writing a status code first

This commit is contained in:
WeidiDeng 2026-04-21 14:55:56 +08:00 committed by Francis Lavoie
parent f970f397e2
commit ed44e4d3f6
No known key found for this signature in database

View File

@ -272,8 +272,8 @@ func (rr *responseRecorder) Hijack() (net.Conn, *bufio.ReadWriter, error) {
if !rr.wroteHeader {
// hijacking without writing status code first works as long as subsequent writes follows http1.1
// wire format, but it will show up with a status code of 0 in the access log and bytes written
// will include response headers.
caddy.Log().Debug("hijacking without writing status code first")
// will include response headers. Response headers won't be present in the log if not set on the response writer.
caddy.Log().Warn("hijacking without writing status code first")
}
//nolint:bodyclose
conn, brw, err := http.NewResponseController(rr.ResponseWriterWrapper).Hijack()