Skip to content

Commit 82af8ac

Browse files
mildsunriseMylesBorins
authored andcommittedNov 16, 2020
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) Backport-PR-URL: #34845 PR-URL: #28044 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
1 parent e85ca7a commit 82af8ac

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed
 

‎doc/api/http2.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -927,8 +927,9 @@ the value is `undefined`, the stream is not yet ready for use.
927927
All [`Http2Stream`][] instances are destroyed either when:
928928

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

934935
When an `Http2Stream` instance is destroyed, an attempt will be made to send an

‎src/node_http2.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -2367,7 +2367,7 @@ ssize_t Http2Stream::Provider::Stream::OnRead(nghttp2_session* handle,
23672367
return NGHTTP2_ERR_DEFERRED;
23682368
}
23692369

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

0 commit comments

Comments
 (0)
Please sign in to comment.