-
Notifications
You must be signed in to change notification settings - Fork 32
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
Server checking if stream closed #175
Comments
Thanks for opening an issue, and for the kind words. I agree with you. These should definitely be handled better. A few thoughts:
Both alternatives above are technically breaking changes, so I think we get to pick. Do you see other alternatives? |
100% agreed on point 1, I think something like an For point 3, I personally like For your last point, this is a bit difficult for me since I don't have much low-level experience of directly interacting with transport protocols. I mainly use go and HTTP/1 at my day job (whose server-side request cancellation detection appears to come from a and b), and I know .NET has something similar (but I have no experience with), so to me the approach I think would be easiest for consumers would be to make this property accessible from the request context. Either through To me, adding something like EDIT: |
(for already closed stream) anmonteiro/ocaml-h2#175
(for already closed stream) anmonteiro/ocaml-h2#175
(for already closed stream) anmonteiro/ocaml-h2#175
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 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 aFailure
orAssert_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.
The text was updated successfully, but these errors were encountered: