Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
http2,doc: minor fixes
Some small fixes on HTTP/2 and its documentation:

 - Add a note that, on server streams, it's not necessary
   to start data flow.

 - Set EOF flag if we have marked all data for sending:
   there's no need to wait until the queue is
   actually empty (and send a separate, empty DATA).

   (Note that, even with this change, a separate DATA
   frame will always be sent, because the streams
   layer waits until data has been flushed before
   dispatching EOF)

PR-URL: #28044
Backport-PR-URL: #34857
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
  • Loading branch information
mildsunrise authored and richardlau committed Oct 7, 2020
commit 751820b6c2d831b6ca0dc90c43b952d2001f1173
5 changes: 3 additions & 2 deletions doc/api/http2.md
Original file line number Diff line number Diff line change
Expand Up @@ -903,8 +903,9 @@ the value is `undefined`, the stream is not yet ready for use.
All [`Http2Stream`][] instances are destroyed either when:

* An `RST_STREAM` frame for the stream is received by the connected peer,
and pending data has been read.
* The `http2stream.close()` method is called, and pending data has been read.
and (for client streams only) pending data has been read.
* The `http2stream.close()` method is called, and (for client streams only)
pending data has been read.
* The `http2stream.destroy()` or `http2session.destroy()` methods are called.

When an `Http2Stream` instance is destroyed, an attempt will be made to send an
Expand Down
2 changes: 1 addition & 1 deletion src/node_http2.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2452,7 +2452,7 @@ ssize_t Http2Stream::Provider::Stream::OnRead(nghttp2_session* handle,
return NGHTTP2_ERR_DEFERRED;
}

if (stream->queue_.empty() && !stream->IsWritable()) {
if (stream->available_outbound_length_ == 0 && !stream->IsWritable()) {
Debug(session, "no more data for stream %d", id);
*flags |= NGHTTP2_DATA_FLAG_EOF;
if (stream->HasTrailers()) {
Expand Down