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
parent 44d453de3c
commit 050d137e76
No known key found for this signature in database
GPG Key ID: 25F87CE1741EC7CD

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