Skip to content

Commit

Permalink
xmlrpc_client: remove us of Buf_io
Browse files Browse the repository at this point in the history
The function `check_reusable_inner` used Buf_io to read a fixed-length
HTTP response and then discarded the buffer. This is functionally the
same as using `Unixext.really_read_string`, so do that instead.

Signed-off-by: Rob Hoes <[email protected]>
  • Loading branch information
robhoes committed Oct 17, 2024
1 parent c02f653 commit a49ae63
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions ocaml/libs/http-lib/xmlrpc_client.ml
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,7 @@ let check_reusable_inner (x : Unixfd.t) =
match response.Http.Response.content_length with
| Some len -> (
let len = Int64.to_int len in
let tmp = Bytes.make len 'X' in
let buf = Buf_io.of_fd Unixfd.(!x) in
Buf_io.really_input buf tmp 0 len ;
let tmp = Bytes.unsafe_to_string tmp in
let tmp = Unixext.really_read_string Unixfd.(!x) len in
match XMLRPC.From.methodResponse (Xml.parse_string tmp) with
| XMLRPC.Failure ("MESSAGE_METHOD_UNKNOWN", [param])
when param = msg_func ->
Expand Down

0 comments on commit a49ae63

Please sign in to comment.