Skip to content

Commit

Permalink
Merge pull request #23 from reynir/fix-h2-shutdown
Browse files Browse the repository at this point in the history
H2: shutdown the connection once finished
  • Loading branch information
reynir authored Jan 6, 2024
2 parents b23065a + 976bb80 commit e0ce59b
Showing 1 changed file with 6 additions and 3 deletions.
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

0 comments on commit e0ce59b

Please sign in to comment.