Skip to content

Commit

Permalink
http-svr: remove read from Buf_io in read_body
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
robhoes committed Oct 17, 2024
1 parent a49ae63 commit 8a829ec
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions ocaml/libs/http-lib/http_svr.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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 *)

Expand Down

0 comments on commit 8a829ec

Please sign in to comment.