From cc561cc5a70a43eb9fd6b4f64f5263b10ee4124c 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 Backport-PR-URL: https://github.com/nodejs/node/pull/22850 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 | 2 ++ test/parallel/test-http2-server-push-stream.js | 8 ++++++++ 5 files changed, 21 insertions(+) diff --git a/doc/api/errors.md b/doc/api/errors.md index 13193f95ca9af8..8632bb7be28484 100755 --- a/doc/api/errors.md +++ b/doc/api/errors.md @@ -775,6 +775,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 3da544420077dc..cd4edbc6c89214 100644 --- a/doc/api/http2.md +++ b/doc/api/http2.md @@ -1261,6 +1261,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]])