Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
klauspost committed May 31, 2021
1 parent 0d3b288 commit a40438b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion gzhttp/gzip.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,13 +170,14 @@ func (w *GzipResponseWriter) startPlain() error {
return nil
}
n, err := w.ResponseWriter.Write(w.buf)
w.buf = nil
// This should never happen (per io.Writer docs), but if the write didn't
// accept the entire buffer but returned no specific error, we have no clue
// what's going on, so abort just to be safe.
if err == nil && n < len(w.buf) {
err = io.ErrShortWrite
}

w.buf = nil
return err
}

Expand Down

0 comments on commit a40438b

Please sign in to comment.