http2: empty DATA frame used instead of END_STREAM on last DATA frame
- Version: v14.3.0
- Platform: Mac OS X
- Subsystem: http2
What steps will reproduce the bug?
Http2Stream.end('data');
How often does it reproduce? Is there a required condition?
It occurs as long as there are no trailers (which means always on ClientHttp2Stream)
What is the expected behavior?
The DATA frame with the last piece of data should have the END_STREAM flag.
What do you see instead?
| if (stream->available_outbound_length_ == 0 && !stream->is_writable()) { | |
| Debug(session, "no more data for stream %d", id); | |
| *flags |= NGHTTP2_DATA_FLAG_EOF; | |
| if (stream->has_trailers()) { | |
| *flags |= NGHTTP2_DATA_FLAG_NO_END_STREAM; | |
| stream->OnTrailers(); | |
| } | |
| } |
The NGHTTP2_DATA_FLAG_EOF is only set if the outbound stream is no long writable (eg: on shutdown), but not if the internal (Writable) stream has ended.
Additional information
This is how curl, Chrome, and Safari send DATA frames, wherein the last DATA frame contains the END_STREAM flag, instead of sending an empty frame. It makes it more difficult to test http2 if nodeJS applies different logic. Performance-wise, it's a wasted packet.