-
Notifications
You must be signed in to change notification settings - Fork 931
Description
Hi,
Using 1.14.1.
I noticed today that if I do the following sequence:
- nghttp2_submit_response(...)
- nghttp2_submit_rst_stream(...)
- nghttp2_session_send(...)
The headers frame for the stream is dropped during send. The use case is I want to respond before the request is complete, so I do a full response, then reset the stream so the client cannot send any more incoming stream frames. However I do want the client to see the response headers.
If I do nghttp2_session_send() before nghttp2_submit_rst_stream() things work as expected.
What are your thoughts here in terms of how the library should handle this? The main issue for me is that I do a bunch of things in callbacks, and AFAIK it's not recommended to call nghttp2_session_send() from within a callback, and furthermore it make error handling for me a lot more complicated as I use exceptions. So right now I call nghttp2_session_send() after dispatching and all callbacks have been called.
I can handle this in the app code potentially, but wanted to see whether you think this is the right library behavior.
For reference, here is Envoy's HTTP/2 codec code which uses nghttp2 (happy that I can finally share this):
https://github.com/lyft/envoy/blob/master/source/common/http/http2/codec_impl.cc
Thanks,
Matt