Skip to content

Remove Buf_io from the HTTP server #6064

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Oct 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ocaml/database/database_server_main.ml
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ let _ =
let socket = Http_svr.bind sockaddr "unix_rpc" in
let server = Http_svr.Server.empty () in
Http_svr.Server.add_handler server Http.Post "/post_remote_db_access"
(Http_svr.BufIO remote_database_access_handler_v1) ;
remote_database_access_handler_v1 ;
Http_svr.Server.add_handler server Http.Post "/post_remote_db_access_v2"
(Http_svr.BufIO remote_database_access_handler_v2) ;
remote_database_access_handler_v2 ;
Http_svr.start ~conn_limit:1024 server socket ;
Printf.printf "server listening\n%!" ;
if !self_test then (
Expand Down
5 changes: 2 additions & 3 deletions ocaml/database/db_remote_cache_access_v1.ml
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,10 @@ module DBCacheRemoteListener = struct
raise e
end

let handler req bio _ =
let fd = Buf_io.fd_of bio in
let handler req fd _ =
(* fd only used for writing *)
let body =
Http_svr.read_body ~limit:Db_globs.http_limit_max_rpc_size req bio
Http_svr.read_body ~limit:Db_globs.http_limit_max_rpc_size req fd
in
let body_xml = Xml.parse_string body in
let reply_xml = DBCacheRemoteListener.process_xmlrpc body_xml in
Expand Down
2 changes: 1 addition & 1 deletion ocaml/database/db_remote_cache_access_v1.mli
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
val handler : Http.Request.t -> Buf_io.t -> 'a -> unit
val handler : Http.Request.t -> Unix.file_descr -> 'a -> unit
(** HTTP handler for v1 of the remote DB access protocol *)
5 changes: 2 additions & 3 deletions ocaml/database/db_remote_cache_access_v2.ml
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,10 @@ let process_rpc (req : Rpc.t) =
Response.Too_many_values (x, y, z)
)

let handler req bio _ =
let fd = Buf_io.fd_of bio in
let handler req fd _ =
(* fd only used for writing *)
let body =
Http_svr.read_body ~limit:Db_globs.http_limit_max_rpc_size req bio
Http_svr.read_body ~limit:Db_globs.http_limit_max_rpc_size req fd
in
let request_rpc = Jsonrpc.of_string body in
let reply_rpc = process_rpc request_rpc in
Expand Down
2 changes: 1 addition & 1 deletion ocaml/database/db_remote_cache_access_v2.mli
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
val handler : Http.Request.t -> Buf_io.t -> 'a -> unit
val handler : Http.Request.t -> Unix.file_descr -> 'a -> unit
(** HTTP handler for v2 of the remote DB access protocol *)
157 changes: 0 additions & 157 deletions ocaml/libs/http-lib/buf_io.ml

This file was deleted.

60 changes: 0 additions & 60 deletions ocaml/libs/http-lib/buf_io.mli

This file was deleted.

106 changes: 0 additions & 106 deletions ocaml/libs/http-lib/bufio_test.ml

This file was deleted.

1 change: 0 additions & 1 deletion ocaml/libs/http-lib/bufio_test.mli

This file was deleted.

1 change: 0 additions & 1 deletion ocaml/libs/http-lib/bufio_test_run.ml

This file was deleted.

Empty file.
Loading
Loading