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

H2: shutdown the connection once finished #23

Merged
merged 2 commits into from
Jan 6, 2024
Merged
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
9 changes: 6 additions & 3 deletions src/http_lwt_client.ml
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,7 @@ let single_h2_request ?config fd scheme user_pass host meth path headers body f
Lwt.wakeup_later notify_finished v;
w := true
in
let on_eof response data () = wakeup (Ok (response, data))
in
let on_eof response data () = wakeup (Ok (response, data)) in
let response_handler response response_body =
let response : response = {
version = { major = 2 ; minor = 0 } ;
Expand Down Expand Up @@ -268,7 +267,11 @@ let single_h2_request ?config fd scheme user_pass host meth path headers body f
| Some body -> H2.Body.Writer.write_string request_body body
| None -> ());
H2.Body.Writer.close request_body;
finished
Lwt.finalize
(fun () -> finished)
(fun () ->
H2.Client_connection.shutdown connection;
Lwt.return_unit)

let alpn_protocol = function
| `Plain _ -> None
Expand Down
Loading