mirage / ocaml-cohttp

An OCaml library for HTTP clients and servers using Lwt or Async
Other
703 stars 173 forks source link

Cohttp-lwt, Server: How should we now close `Expert response_action? #990

Open pirbo opened 1 year ago

pirbo commented 1 year ago

Type Cohttp.S.IO.ic is now abstract and (as far as I can see) there is no function provided to "close" one. Therefore either

https://github.com/mirage/ocaml-cohttp/blob/de3900238f6f3cd167fa550c3095e23225147f57/cohttp-lwt/src/s.ml#L293-L294

is not anymore the way to go and the comment needs an update or we need a way to do the recommended action :-)

Note that in any case, this introduce a breaking change as existing code using cohttp.5 has some Lwt_io.close ic that doesn't type anymore. (Discovered by testing the compatibility of https://gitlab.com/nomadic-labs/resto with cohttp.6)

mseri commented 1 year ago

I would go with your second suggestion, do you have a suggestion on how to re-introduce it?

mseri commented 1 year ago

In cohttp-lwt-unix the Input_channel has a close function, perhaps we could make that a requirement from the signature?