Skip to content
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

Fix deprecation warnings #1040

Merged
merged 3 commits into from
Jun 24, 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
2 changes: 1 addition & 1 deletion cohttp-async/src/client.ml
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ module Connection = struct
req oc
>>= fun () ->
read_response ic >>= fun (resp, body) ->
Ivar.fill res (resp, `Pipe body);
Ivar.fill_exn res (resp, `Pipe body);
(* block starting any more requests until the consumer has finished reading this request *)
Pipe.closed body)
|> don't_wait_for;
Expand Down
3 changes: 1 addition & 2 deletions cohttp-async/src/server.ml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ let handle_client handle_request sock rd wr =
Http.Request.is_keep_alive req
&& Http.Response.is_keep_alive res
in
let flush = Http.Response.flush res in
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not clear to me we want to remove this completely - @rgrinberg what's the intended use for those nowadays?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think they're useless. Flushing should just be done for every request/response.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

flush defaults to true, so removing these lines is ok.

let res =
let headers =
Http.Header.add_unless_exists
Expand All @@ -95,7 +94,7 @@ let handle_client handle_request sock rd wr =
in
{ res with Http.Response.headers }
in
Io.Response.write ~flush
Io.Response.write
(Body.Private.write_body Io.Response.write_body res_body)
res wr
>>= fun () ->
Expand Down
7 changes: 4 additions & 3 deletions cohttp-curl-async/src/cohttp_curl_async.ml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ module Context = struct
| None -> ()
| Some w ->
Hashtbl.remove t.wakeners h;
Ivar.fill w code);
Ivar.fill_exn w code);
finished s
in
let on_readable fd =
Expand Down Expand Up @@ -102,7 +102,7 @@ module Context = struct
| Some _, true -> ()
| None, true -> set_event (Some (create_event fd what))
| Some ivar, false ->
Ivar.fill ivar ();
Ivar.fill_exn ivar ();
set_event None
in
update current.fd
Expand Down Expand Up @@ -168,7 +168,8 @@ module Request = struct
timeout
in
Cohttp_curl.Request.create ?timeout_ms ?headers method_ ~uri ~input
~output ~on_response:(Ivar.fill response_ready)
~output
~on_response:(Ivar.fill_exn response_ready)
in
{ base; response_ready = Ivar.read response_ready; body_ready }
end
Expand Down
3 changes: 1 addition & 2 deletions cohttp-lwt/src/server.ml
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,7 @@ module Make (IO : S.IO) = struct

let handle_response ~keep_alive oc res body conn_closed handle_client =
IO.catch (fun () ->
let flush = Response.flush res in
Response.write ~flush
Response.write
(fun writer -> Body.write_body (Response.write_body writer) body)
res oc)
>>= function
Expand Down
10 changes: 1 addition & 9 deletions http/test/bytebuffer/dune
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
(library
(name bytebuffer_tests)
(libraries
http_bytebuffer
;; This is because of the (implicit_transitive_deps false)
;; in dune-project
ppx_expect.config
ppx_expect.config_types
ppx_expect
base
ppx_inline_test.config)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I separated this change from updating to ppx_expect 0.17.0.

(libraries http_bytebuffer)
(inline_tests)
(preprocess
(pps ppx_expect)))
Loading