Files
mediamtx/internal/protocols/httpp
Hudson CavazinandGitHub ccf1b61e20 httpp: propagate Flush() through the response writer wrappers (#6126)
handlerLogger's responseRecorder and handlerWriteTimeout's writeTimeoutWriter
both wrap http.ResponseWriter but implement neither http.Flusher nor Unwrap().
Any handler that flushes mid-response has that flush silently dropped, and its
output only reaches the client when the handler returns.

That defeats the stated purpose of writeTimeoutWriter, whose own comment says it
exists so one can "write long responses, splitted in chunks, without causing
timeouts": the deadline is reset per Write(), but nothing ever leaves the buffer
until the end.

Found while adding a server-sent-events endpoint: events written and flushed at
t=0.4s only reached the client at t=2.2s, when the handler returned.

Adding Flush() plus Unwrap() (so http.ResponseController can reach through) fixes
both. The new test drives a real listener through both wrappers and reads while
the handler is still blocked, so it fails on the current code by hitting the read
deadline.
2026-08-24 14:40:43 +00:00
..
2026-08-04 22:13:15 +00:00
2026-08-04 22:13:15 +00:00