anmonteiro / anmonteiro/ocaml-h2
Server checking if stream closed
- Lenguaje dominante
- OCaml
- Estrellas
- 318
- Forks
- 37
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
`H2.Reqd` fails various operations (`respond_with_streaming`, `schedule_trailers`, others) if the client closes the stream, but currently it doesn't look like there's a way for the for a server implementation to avoid/handle these failures.
I would think the clearest way to propagate cancellation would be to make `~request_handler` for the lwt/async server implementations accept a promise which is resolved/rejected when the stream is closed. However that might require a version bump, so it might be simpler to just raise an exception other than `Failure` (such as currently the case with [schedule_trailers](https://github.com/anmonteiro/ocaml-h2/blob/0f54f6e/lib/reqd.ml#L204)) or `Assert_failure` (currently the case with [respond_with_streaming](https://github.com/anmonteiro/ocaml-h2/blob/0f54f6e/lib/reqd.ml#L288)) when trying to respond on a closed stream. Making the server explicitly catch a `Failure` or `Assert_failure` seems like a bad idea, since we would unintentionally catch actual unexpected errors, but this seems like an expected case that a server should be able to gracefully handle.
I'm a huge fan of this project, and thank you for all of your work (I'm fairly new to ocaml and have found this project incredibly approachable), so sorry if this is something that's already possible that I missed.
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Evaluación
Este issue todavía no se ha evaluado.