GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — http2: explicitly disallow nested push streams · nodejs/node@7223a91

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • doc/api
    • errors.md
    • http2.md
  • lib/internal
    • errors.js
    • http2
      • core.js
  • test/parallel
    • test-http2-server-push-stream.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎doc/api/errors.md‎

Copy file name to clipboardExpand all lines: doc/api/errors.md
+6Lines changed: 6 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -956,6 +956,12 @@ required to send an acknowledgment that it has received and applied the new
956956
be sent at any given time. This error code is used when that limit has been
957957
reached.
958958

959+
<a id="ERR_HTTP2_NESTED_PUSH"></a>
960+
### ERR_HTTP2_NESTED_PUSH
961+
962+
An attempt was made to initiate a new push stream from within a push stream.
963+
Nested push streams are not permitted.
964+
959965
<a id="ERR_HTTP2_NO_SOCKET_MANIPULATION"></a>
960966
### ERR_HTTP2_NO_SOCKET_MANIPULATION
961967

Collapse file

‎doc/api/http2.md‎

Copy file name to clipboardExpand all lines: doc/api/http2.md
+3Lines changed: 3 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -1256,6 +1256,9 @@ Setting the weight of a push stream is not allowed in the `HEADERS` frame. Pass
12561256
a `weight` value to `http2stream.priority` with the `silent` option set to
12571257
`true` to enable server-side bandwidth balancing between concurrent streams.
12581258

1259+
Calling `http2stream.pushStream()` from within a pushed stream is not permitted
1260+
and will throw an error.
1261+
12591262
#### http2stream.respond([headers[, options]])
12601263
<!-- YAML
12611264
added: v8.4.0
Collapse file

‎lib/internal/errors.js‎

Copy file name to clipboardExpand all lines: lib/internal/errors.js
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -568,6 +568,8 @@ E('ERR_HTTP2_INVALID_SETTING_VALUE',
568568
E('ERR_HTTP2_INVALID_STREAM', 'The stream has been destroyed', Error);
569569
E('ERR_HTTP2_MAX_PENDING_SETTINGS_ACK',
570570
'Maximum number of pending settings acknowledgements', Error);
571+
E('ERR_HTTP2_NESTED_PUSH',
572+
'A push stream cannot initiate another push stream.', Error);
571573
E('ERR_HTTP2_NO_SOCKET_MANIPULATION',
572574
'HTTP/2 sockets should not be directly manipulated (e.g. read and written)',
573575
Error);
Collapse file

‎lib/internal/http2/core.js‎

Copy file name to clipboardExpand all lines: lib/internal/http2/core.js
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ const {
4747
ERR_HTTP2_INVALID_SETTING_VALUE,
4848
ERR_HTTP2_INVALID_STREAM,
4949
ERR_HTTP2_MAX_PENDING_SETTINGS_ACK,
50+
ERR_HTTP2_NESTED_PUSH,
5051
ERR_HTTP2_NO_SOCKET_MANIPULATION,
5152
ERR_HTTP2_OUT_OF_STREAMS,
5253
ERR_HTTP2_PAYLOAD_FORBIDDEN,
@@ -2158,6 +2159,8 @@ class ServerHttp2Stream extends Http2Stream {
21582159
pushStream(headers, options, callback) {
21592160
if (!this.pushAllowed)
21602161
throw new ERR_HTTP2_PUSH_DISABLED();
2162+
if (this[kID] % 2 === 0)
2163+
throw new ERR_HTTP2_NESTED_PUSH();
21612164

21622165
const session = this[kSession];
21632166

Collapse file

‎test/parallel/test-http2-server-push-stream.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-http2-server-push-stream.js
+8Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,14 @@ server.on('stream', common.mustCall((stream, headers) => {
2222
'x-push-data': 'pushed by server',
2323
});
2424
push.end('pushed by server data');
25+
26+
common.expectsError(() => {
27+
push.pushStream({}, common.mustNotCall());
28+
}, {
29+
code: 'ERR_HTTP2_NESTED_PUSH',
30+
type: Error
31+
});
32+
2533
stream.end('test');
2634
}));
2735
}

0 commit comments

Comments
0 (0)
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.