Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flush compressed streams #483

Merged
merged 1 commit into from Feb 25, 2020
Merged

Flush compressed streams #483

merged 1 commit into from Feb 25, 2020

Conversation

@remko
Copy link
Contributor

remko commented Jan 14, 2020

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.

@ChadTaljaardt

This comment has been minimized.

Copy link

ChadTaljaardt commented Feb 25, 2020

I am getting the same issue as listed here, @pkieltyka Could you take a look at this when you get a second?

@pkieltyka pkieltyka merged commit 1ee08bf into go-chi:master Feb 25, 2020
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.