From 8a829ec8e1d5bba2de0f780d9119edb138a9eb44 Mon Sep 17 00:00:00 2001 From: Rob Hoes Date: Thu, 17 Oct 2024 14:30:15 +0000 Subject: [PATCH] http-svr: remove read from Buf_io in read_body At this point, the only function in the entire code base that read from a Buf_io.t is `Http_svr.read_body` (apart from a test for Buf_io). However, it only does so if the buffer is not empty and falls back to reading directly from the fd is not. And since nothing else reads from a Buf_io, the buffer is always empty... Signed-off-by: Rob Hoes --- ocaml/libs/http-lib/http_svr.ml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/ocaml/libs/http-lib/http_svr.ml b/ocaml/libs/http-lib/http_svr.ml index 1a846ea629a..d75726f184c 100644 --- a/ocaml/libs/http-lib/http_svr.ml +++ b/ocaml/libs/http-lib/http_svr.ml @@ -696,10 +696,7 @@ let read_body ?limit req bio = if length > l then raise Client_requested_size_over_limit ) limit ; - if Buf_io.is_buffer_empty bio then - Unixext.really_read_string (Buf_io.fd_of bio) length - else - Buf_io.really_input_buf ~timeout:Buf_io.infinite_timeout bio length + Unixext.really_read_string (Buf_io.fd_of bio) length (* Helpers to determine the client of a call *)