Skip to content

Commit 8c331c6

Browse files
committed
http2: consider priotity weight a no-op following nghttp2 1.65.0 change
Signed-off-by: Matteo Collina <[email protected]>
1 parent 7f84bc6 commit 8c331c6

File tree

3 files changed

+23
-12
lines changed

3 files changed

+23
-12
lines changed

doc/api/http2.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1457,6 +1457,13 @@ numeric stream identifier.
14571457

14581458
<!-- YAML
14591459
added: v8.4.0
1460+
deprecated:
1461+
- REPLACEME
1462+
changes:
1463+
- version:
1464+
- REPLACEME
1465+
pr-url: REPLACEME
1466+
description: Following the update of nghttp2 to v1.65.0, this is now a no-op.
14601467
-->
14611468

14621469
* `options` {Object}
@@ -1473,6 +1480,7 @@ added: v8.4.0
14731480
sending a `PRIORITY` frame to the connected peer.
14741481

14751482
Updates the priority for this `Http2Stream` instance.
1483+
The priority is ignored.
14761484

14771485
#### `http2stream.rstCode`
14781486

@@ -1568,6 +1576,12 @@ req.setTimeout(5000, () => req.close(NGHTTP2_CANCEL));
15681576

15691577
<!-- YAML
15701578
added: v8.4.0
1579+
changes:
1580+
- version:
1581+
- REPLACEME
1582+
pr-url: REPLACEME
1583+
description: Following the change in nghttp2 v1.65.0, the `state.weight` property is
1584+
now always set to 16.
15711585
-->
15721586

15731587
Provides miscellaneous information about the current state of the
@@ -1584,7 +1598,8 @@ Provides miscellaneous information about the current state of the
15841598
* `sumDependencyWeight` {number} The sum weight of all `Http2Stream`
15851599
instances that depend on this `Http2Stream` as specified using
15861600
`PRIORITY` frames.
1587-
* `weight` {number} The priority weight of this `Http2Stream`.
1601+
* `weight` {number} The priority weight of this `Http2Stream`. This weight is now
1602+
always set to `16`.
15881603

15891604
A current state of this `Http2Stream`.
15901605

test/parallel/test-http2-client-set-priority.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ const http2 = require('http2');
99
const checkWeight = (actual, expect) => {
1010
const server = http2.createServer();
1111
server.on('stream', common.mustCall((stream, headers, flags) => {
12-
assert.strictEqual(stream.state.weight, expect);
12+
// Priority has been removed from nghttp2, so this is always 16
13+
// starting from nghttp2 1.65.0
14+
assert.strictEqual(stream.state.weight, 16);
1315
stream.respond();
1416
stream.end('test');
1517
}));

test/parallel/test-http2-priority-event.js

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,13 @@
33
const common = require('../common');
44
if (!common.hasCrypto)
55
common.skip('missing crypto');
6-
const assert = require('assert');
76
const h2 = require('http2');
87

98
const server = h2.createServer();
109

1110
// We use the lower-level API here
1211
server.on('stream', common.mustCall(onStream));
1312

14-
function onPriority(stream, parent, weight, exclusive) {
15-
assert.strictEqual(stream, 1);
16-
assert.strictEqual(parent, 0);
17-
assert.strictEqual(weight, 1);
18-
assert.strictEqual(exclusive, false);
19-
}
20-
2113
function onStream(stream, headers, flags) {
2214
stream.priority({
2315
parent: 0,
@@ -33,7 +25,7 @@ function onStream(stream, headers, flags) {
3325

3426
server.listen(0);
3527

36-
server.on('priority', common.mustCall(onPriority));
28+
server.on('priority', common.mustNotCall());
3729

3830
server.on('listening', common.mustCall(() => {
3931

@@ -48,7 +40,9 @@ server.on('listening', common.mustCall(() => {
4840
});
4941
});
5042

51-
req.on('priority', common.mustCall(onPriority));
43+
// The priority event is not supported anymore by nghttp2
44+
// since 1.65.0.
45+
req.on('priority', common.mustNotCall());
5246

5347
req.on('response', common.mustCall());
5448
req.resume();

0 commit comments

Comments
 (0)