| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -956,6 +956,12 @@ required to send an acknowledgment that it has received and applied the new | |||
| 956 | 956 | be sent at any given time. This error code is used when that limit has been | |
| 957 | 957 | reached. | |
| 958 | 958 | ||
| 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 | + | ||
| 959 | 965 | <a id="ERR_HTTP2_NO_SOCKET_MANIPULATION"></a> | |
| 960 | 966 | ### ERR_HTTP2_NO_SOCKET_MANIPULATION | |
| 961 | 967 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1256,6 +1256,9 @@ Setting the weight of a push stream is not allowed in the `HEADERS` frame. Pass | |||
| 1256 | 1256 | a `weight` value to `http2stream.priority` with the `silent` option set to | |
| 1257 | 1257 | `true` to enable server-side bandwidth balancing between concurrent streams. | |
| 1258 | 1258 | ||
| 1259 | + Calling `http2stream.pushStream()` from within a pushed stream is not permitted | ||
| 1260 | + and will throw an error. | ||
| 1261 | + | ||
| 1259 | 1262 | #### http2stream.respond([headers[, options]]) | |
| 1260 | 1263 | <!-- YAML | |
| 1261 | 1264 | added: v8.4.0 | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -568,6 +568,8 @@ E('ERR_HTTP2_INVALID_SETTING_VALUE', | |||
| 568 | 568 | E('ERR_HTTP2_INVALID_STREAM', 'The stream has been destroyed', Error); | |
| 569 | 569 | E('ERR_HTTP2_MAX_PENDING_SETTINGS_ACK', | |
| 570 | 570 | 'Maximum number of pending settings acknowledgements', Error); | |
| 571 | + E('ERR_HTTP2_NESTED_PUSH', | ||
| 572 | + 'A push stream cannot initiate another push stream.', Error); | ||
| 571 | 573 | E('ERR_HTTP2_NO_SOCKET_MANIPULATION', | |
| 572 | 574 | 'HTTP/2 sockets should not be directly manipulated (e.g. read and written)', | |
| 573 | 575 | Error); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -47,6 +47,7 @@ const { | |||
| 47 | 47 | ERR_HTTP2_INVALID_SETTING_VALUE, | |
| 48 | 48 | ERR_HTTP2_INVALID_STREAM, | |
| 49 | 49 | ERR_HTTP2_MAX_PENDING_SETTINGS_ACK, | |
| 50 | + ERR_HTTP2_NESTED_PUSH, | ||
| 50 | 51 | ERR_HTTP2_NO_SOCKET_MANIPULATION, | |
| 51 | 52 | ERR_HTTP2_OUT_OF_STREAMS, | |
| 52 | 53 | ERR_HTTP2_PAYLOAD_FORBIDDEN, | |
@@ -2158,6 +2159,8 @@ class ServerHttp2Stream extends Http2Stream { | |||
| 2158 | 2159 | pushStream(headers, options, callback) { | |
| 2159 | 2160 | if (!this.pushAllowed) | |
| 2160 | 2161 | throw new ERR_HTTP2_PUSH_DISABLED(); | |
| 2162 | + if (this[kID] % 2 === 0) | ||
| 2163 | + throw new ERR_HTTP2_NESTED_PUSH(); | ||
| 2161 | 2164 | ||
| 2162 | 2165 | const session = this[kSession]; | |
| 2163 | 2166 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -22,6 +22,14 @@ server.on('stream', common.mustCall((stream, headers) => { | |||
| 22 | 22 | 'x-push-data': 'pushed by server', | |
| 23 | 23 | }); | |
| 24 | 24 | 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 | + | ||
| 25 | 33 | stream.end('test'); | |
| 26 | 34 | })); | |
| 27 | 35 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments