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) or Assert_failure (currently the case with respond_with_streaming) 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.
H2.Reqdfails 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_handlerfor 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 thanFailure(such as currently the case with schedule_trailers) orAssert_failure(currently the case with respond_with_streaming) when trying to respond on a closed stream. Making the server explicitly catch aFailureorAssert_failureseems 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.