From 78584b64d88c0567c46e3cf7bae42aa73927df40 Mon Sep 17 00:00:00 2001 From: James M Snell Date: Fri, 10 Aug 2018 11:05:57 -0700 Subject: [PATCH] http2: explicitly disallow nested push streams Fixes: https://github.com/nodejs/node/issues/19095 PR-URL: https://github.com/nodejs/node/pull/22245 Reviewed-By: Matteo Collina Reviewed-By: Trivikram Kamat --- doc/api/errors.md | 6 ++++++ doc/api/http2.md | 3 +++ lib/internal/errors.js | 2 ++ lib/internal/http2/core.js | 3 +++ test/parallel/test-http2-server-push-stream.js | 8 ++++++++ 5 files changed, 22 insertions(+) diff --git a/doc/api/errors.md b/doc/api/errors.md index f7fb1a28b12d41..e4a709d45a8031 100644 --- a/doc/api/errors.md +++ b/doc/api/errors.md @@ -956,6 +956,12 @@ required to send an acknowledgment that it has received and applied the new be sent at any given time. This error code is used when that limit has been reached. + +### ERR_HTTP2_NESTED_PUSH + +An attempt was made to initiate a new push stream from within a push stream. +Nested push streams are not permitted. + ### ERR_HTTP2_NO_SOCKET_MANIPULATION diff --git a/doc/api/http2.md b/doc/api/http2.md index 4d56b61839c227..05b5ff7718d4aa 100644 --- a/doc/api/http2.md +++ b/doc/api/http2.md @@ -1256,6 +1256,9 @@ Setting the weight of a push stream is not allowed in the `HEADERS` frame. Pass a `weight` value to `http2stream.priority` with the `silent` option set to `true` to enable server-side bandwidth balancing between concurrent streams. +Calling `http2stream.pushStream()` from within a pushed stream is not permitted +and will throw an error. + #### http2stream.respond([headers[, options]])