From 3cdec1c0c7ee9dcb90653c2ca4f7f11d21155c31 Mon Sep 17 00:00:00 2001 From: Simon Cruanes Date: Tue, 18 Jun 2024 17:04:19 -0400 Subject: [PATCH] fix --- src/core/IO.ml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/core/IO.ml b/src/core/IO.ml index 3307537a..138668c4 100644 --- a/src/core/IO.ml +++ b/src/core/IO.ml @@ -348,7 +348,14 @@ module Input = struct method private refill (slice : Slice.t) : unit = if !chunk_size = 0 && not !eof then ( chunk_size := read_next_chunk_len (); - if !chunk_size = 0 then eof := true (* stream is finished *) + if !chunk_size = 0 then ( + (* stream is finished, consume trailing \r\n *) + eof := true; + let line = read_line_using ~buf:line_buf ic in + if String.trim line <> "" then + raise + (fail (spf "expected \\r\\n to follow last chunk, got %S" line)) + ) ); slice.off <- 0; slice.len <- 0;