Skip to content

Commit 4c36cd1

Browse files
committed
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)
1 parent 5ee1e31 commit 4c36cd1

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

doc/api/http2.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -913,8 +913,9 @@ the value is `undefined`, the stream is not yet ready for use.
913913
All [`Http2Stream`][] instances are destroyed either when:
914914

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

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

src/node_http2.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2309,7 +2309,7 @@ ssize_t Http2Stream::Provider::Stream::OnRead(nghttp2_session* handle,
23092309
return NGHTTP2_ERR_DEFERRED;
23102310
}
23112311

2312-
if (stream->queue_.empty() && !stream->is_writable()) {
2312+
if (stream->available_outbound_length_ == 0 && !stream->is_writable()) {
23132313
Debug(session, "no more data for stream %d", id);
23142314
*flags |= NGHTTP2_DATA_FLAG_EOF;
23152315
if (stream->has_trailers()) {

0 commit comments

Comments
 (0)