mirror of
https://github.com/nghttp2/nghttp2.git
synced 2025-12-09 19:48:53 +08:00
nghttp2_submit_request and nghttp2_submit_response will set NGHTTP2_FLAG_END_STREAM after all given data is sent (data could be 0). This means we have no way to send trailers. In this commit, we added NGHTTP2_DATA_FLAG_NO_END_STREAM flag. The application can set this flag in *data_flags inside nghttp2_data_source_read_callback. If NGHTTP2_DATA_FLAG_EOF is set, library automatically set NGHTTP2_FLAG_END_STREAM. But if both NGHTTP2_DATA_FLAG_EOF and NGHTTP2_DATA_FLAG_NO_END_STREAM are set, NGHTTP2_FLAG_END_STREAM will not set by library. Then application can use new nghttp2_submit_trailer() to send trailers. nghttp2_submit_trailer() will set NGHTTP2_FLAG_END_STREAM and it is actually thing wrapper of nghttp2_submit_headers().