Skip to content

Commit 4adb9e8

Browse files
committed
Deflatemod: Don't flush when buffer is empty
1 parent fc3547b commit 4adb9e8

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/extensions/deflatemod.ml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,9 @@ let write_int32 buf offset n =
7171

7272
let compress_flush oz used_out =
7373
Logs.debug ~src:section (fun fmt -> fmt "Flushing %d bytes" used_out);
74-
oz.flush (Bytes.sub_string oz.buf 0 used_out)
74+
if used_out > 0
75+
then oz.flush (Bytes.sub_string oz.buf 0 used_out)
76+
else Lwt.return_unit
7577

7678
(* gzip trailer *)
7779
let write_trailer oz =

0 commit comments

Comments
 (0)