Skip to content

Commit 3cdec1c

Browse files
committed
fix
1 parent 4705278 commit 3cdec1c

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/core/IO.ml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,14 @@ module Input = struct
348348
method private refill (slice : Slice.t) : unit =
349349
if !chunk_size = 0 && not !eof then (
350350
chunk_size := read_next_chunk_len ();
351-
if !chunk_size = 0 then eof := true (* stream is finished *)
351+
if !chunk_size = 0 then (
352+
(* stream is finished, consume trailing \r\n *)
353+
eof := true;
354+
let line = read_line_using ~buf:line_buf ic in
355+
if String.trim line <> "" then
356+
raise
357+
(fail (spf "expected \\r\\n to follow last chunk, got %S" line))
358+
)
352359
);
353360
slice.off <- 0;
354361
slice.len <- 0;

0 commit comments

Comments
 (0)