Skip to content

Commit

Permalink
fix flushing of transparently compressed gzip output
Browse files Browse the repository at this point in the history
this is a problem for connections like SSE, that only send data on events.
those events would stay in the gzip buffer until lots more data was written.

bug because of automatically typing "if err != nil"...

found while testing the maildir/mbox web-based import while working on message
threading support. the import gets progress SSE events that were now hanging.
  • Loading branch information
mjl- committed Sep 12, 2023
1 parent 6f1e38f commit b754b5f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion http/web.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ func (w *loggingWriter) Write(buf []byte) (int, error) {
// issues due to buffering.
// w.Gzip.Write updates w.Size with the compressed byte count.
n, err = w.Gzip.Write(buf)
if err != nil {
if err == nil {
err = w.Gzip.Flush()
}
if n > 0 {
Expand Down

0 comments on commit b754b5f

Please sign in to comment.