summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlba Mendez <me@alba.sh>2020-04-27 03:15:07 +0200
committerRichard Lau <rlau@redhat.com>2020-10-07 09:42:23 -0400
commit751820b6c2d831b6ca0dc90c43b952d2001f1173 (patch)
treec45b1b8f4f43373d367ef3778a994c53819881e0
parent54c2bc2e621fd9cde22ea65bda7f652a63b40340 (diff)
downloadnode-new-751820b6c2d831b6ca0dc90c43b952d2001f1173.tar.gz
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: https://github.com/nodejs/node/pull/28044 Backport-PR-URL: https://github.com/nodejs/node/pull/34857 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
-rw-r--r--doc/api/http2.md5
-rw-r--r--src/node_http2.cc2
2 files changed, 4 insertions, 3 deletions
diff --git a/doc/api/http2.md b/doc/api/http2.md
index bb0ac52dd8..640776f5e8 100644
--- a/doc/api/http2.md
+++ b/doc/api/http2.md
@@ -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
diff --git a/src/node_http2.cc b/src/node_http2.cc
index 9bde444bdd..524729a014 100644
--- a/src/node_http2.cc
+++ b/src/node_http2.cc
@@ -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()) {