Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Flush compressed streams #483
When using stream compression in combination with (SSE) event streams, you need to flush every time you sent an event (to ensure data still in the compression buffer is effectively sent).
The compression middleware's Flush doesn't flush compressed data, because the underlying writer (e.g. gzip.Writer)'s Flush doesn't have the http.Flusher signature (because it has an error return argument).
This patch flushes the underlying stream if it implements gzip's flush signature.
After flushing the GZip stream, the underlying response writer will have pending data as well, and so needs to be flushed too.