mirror of
https://github.com/caddyserver/caddy.git
synced 2024-12-16 21:56:40 -05:00
encode: flush already compressed data from the encoder (#6471)
This commit is contained in:
parent
9cc26ee7bf
commit
976469ca0d
1 changed files with 9 additions and 0 deletions
|
@ -266,6 +266,14 @@ func (rw *responseWriter) FlushError() error {
|
|||
// to rw.Write (see bug in #4314)
|
||||
return nil
|
||||
}
|
||||
// also flushes the encoder, if any
|
||||
// see: https://github.com/jjiang-stripe/caddy-slow-gzip
|
||||
if rw.w != nil {
|
||||
err := rw.w.Flush()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
//nolint:bodyclose
|
||||
return http.NewResponseController(rw.ResponseWriter).Flush()
|
||||
}
|
||||
|
@ -475,6 +483,7 @@ type encodingPreference struct {
|
|||
type Encoder interface {
|
||||
io.WriteCloser
|
||||
Reset(io.Writer)
|
||||
Flush() error // encoder by default buffers data to maximize compressing rate
|
||||
}
|
||||
|
||||
// Encoding is a type which can create encoders of its kind
|
||||
|
|
Loading…
Reference in a new issue