| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent d0b8959 commit 0b987e5
10 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3933,15 +3933,17 @@ an internal nodejs implementation rather than a public facing API, use `node:str | |||
| 3933 | 3933 | ||
| 3934 | 3934 | <!-- YAML | |
| 3935 | 3935 | changes: | |
| 3936 | + - version: REPLACEME | ||
| 3937 | + pr-url: https://github.com/nodejs/node/pull/58293 | ||
| 3938 | + description: End-of-Life. | ||
| 3936 | 3939 | - version: REPLACEME | |
| 3937 | 3940 | pr-url: https://github.com/nodejs/node/pull/58313 | |
| 3938 | 3941 | description: Documentation-only deprecation. | |
| 3939 | 3942 | --> | |
| 3940 | 3943 | ||
| 3941 | - Type: Documentation-only | ||
| 3944 | + Type: End-of-Life | ||
| 3942 | 3945 | ||
| 3943 | - The support for priority signaling has been deprecated in the [RFC 9113][], and | ||
| 3944 | - will be removed in future versions of Node.js. | ||
| 3946 | + The support for priority signaling has been removed following its deprecation in the [RFC 9113][]. | ||
| 3945 | 3947 | ||
| 3946 | 3948 | ### DEP0195: Instantiating `node:http` classes without `new` | |
| 3947 | 3949 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1072,6 +1072,10 @@ The `'origin'` event is only emitted when using a secure TLS connection. | |||
| 1072 | 1072 | <!-- YAML | |
| 1073 | 1073 | added: v8.4.0 | |
| 1074 | 1074 | changes: | |
| 1075 | + - version: REPLACEME | ||
| 1076 | + pr-url: https://github.com/nodejs/node/pull/58293 | ||
| 1077 | + description: The `weight` option is now ignored, setting it will trigger a | ||
| 1078 | + runtime warning. | ||
| 1075 | 1079 | - version: REPLACEME | |
| 1076 | 1080 | pr-url: https://github.com/nodejs/node/pull/58313 | |
| 1077 | 1081 | description: Following the deprecation of priority signaling as of RFC 1993, | |
@@ -1090,10 +1094,6 @@ changes: | |||
| 1090 | 1094 | **Default:** `false`. | |
| 1091 | 1095 | * `parent` {number} Specifies the numeric identifier of a stream the newly | |
| 1092 | 1096 | created stream is dependent on. | |
| 1093 | - * `weight` {number} Specifies the relative dependency of a stream in relation | ||
| 1094 | - to other streams with the same `parent`. The value is a number between `1` | ||
| 1095 | - and `256` (inclusive). This has been **deprecated** in [RFC 9113][], and | ||
| 1096 | - support for it will be removed in future versions of Node.js. | ||
| 1097 | 1097 | * `waitForTrailers` {boolean} When `true`, the `Http2Stream` will emit the | |
| 1098 | 1098 | `'wantTrailers'` event after the final `DATA` frame has been sent. | |
| 1099 | 1099 | * `signal` {AbortSignal} An AbortSignal that may be used to abort an ongoing | |
@@ -1464,25 +1464,17 @@ numeric stream identifier. | |||
| 1464 | 1464 | <!-- YAML | |
| 1465 | 1465 | added: v8.4.0 | |
| 1466 | 1466 | deprecated: REPLACEME | |
| 1467 | + changes: | ||
| 1468 | + - version: REPLACEME | ||
| 1469 | + pr-url: https://github.com/nodejs/node/pull/58293 | ||
| 1470 | + description: This method no longer sets the priority of the stream. Using it | ||
| 1471 | + now triggers a runtime warning. | ||
| 1467 | 1472 | --> | |
| 1468 | 1473 | ||
| 1469 | 1474 | > Stability: 0 - Deprecated: support for priority signaling has been deprecated | |
| 1470 | 1475 | > in the [RFC 9113][] and is no longer supported in Node.js. | |
| 1471 | 1476 | ||
| 1472 | - * `options` {Object} | ||
| 1473 | - * `exclusive` {boolean} When `true` and `parent` identifies a parent Stream, | ||
| 1474 | - this stream is made the sole direct dependency of the parent, with | ||
| 1475 | - all other existing dependents made a dependent of this stream. **Default:** | ||
| 1476 | - `false`. | ||
| 1477 | - * `parent` {number} Specifies the numeric identifier of a stream this stream | ||
| 1478 | - is dependent on. | ||
| 1479 | - * `weight` {number} Specifies the relative dependency of a stream in relation | ||
| 1480 | - to other streams with the same `parent`. The value is a number between `1` | ||
| 1481 | - and `256` (inclusive). | ||
| 1482 | - * `silent` {boolean} When `true`, changes the priority locally without | ||
| 1483 | - sending a `PRIORITY` frame to the connected peer. | ||
| 1484 | - | ||
| 1485 | - Updates the priority for this `Http2Stream` instance. | ||
| 1477 | + Empty method, only there to maintain some backward compatibility. | ||
| 1486 | 1478 | ||
| 1487 | 1479 | #### `http2stream.rstCode` | |
| 1488 | 1480 | ||
@@ -1579,6 +1571,10 @@ req.setTimeout(5000, () => req.close(NGHTTP2_CANCEL)); | |||
| 1579 | 1571 | <!-- YAML | |
| 1580 | 1572 | added: v8.4.0 | |
| 1581 | 1573 | changes: | |
| 1574 | + - version: REPLACEME | ||
| 1575 | + pr-url: https://github.com/nodejs/node/pull/58293 | ||
| 1576 | + description: The `state.weight` property is now always set to 16 and | ||
| 1577 | + `sumDependencyWeight` is always set to 0. | ||
| 1582 | 1578 | - version: REPLACEME | |
| 1583 | 1579 | pr-url: https://github.com/nodejs/node/pull/58313 | |
| 1584 | 1580 | description: Following the deprecation of priority signaling as of RFC 1993, | |
@@ -1596,13 +1592,8 @@ Provides miscellaneous information about the current state of the | |||
| 1596 | 1592 | * `localClose` {number} `1` if this `Http2Stream` has been closed locally. | |
| 1597 | 1593 | * `remoteClose` {number} `1` if this `Http2Stream` has been closed | |
| 1598 | 1594 | remotely. | |
| 1599 | - * `sumDependencyWeight` {number} The sum weight of all `Http2Stream` | ||
| 1600 | - instances that depend on this `Http2Stream` as specified using | ||
| 1601 | - `PRIORITY` frames. This has been **deprecated** in [RFC 9113][], and | ||
| 1602 | - support for it will be removed in future versions of Node.js. | ||
| 1603 | - * `weight` {number} The priority weight of this `Http2Stream`. This has been | ||
| 1604 | - **deprecated** in [RFC 9113][], and support for it will be removed in future | ||
| 1605 | - versions of Node.js. | ||
| 1595 | + * `sumDependencyWeight` {number} Legacy property, always set to `0`. | ||
| 1596 | + * `weight` {number} Legacy property, always set to `16`. | ||
| 1606 | 1597 | ||
| 1607 | 1598 | A current state of this `Http2Stream`. | |
| 1608 | 1599 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -30,6 +30,8 @@ const { | |||
| 30 | 30 | customInspectSymbol: kInspect, | |
| 31 | 31 | kEmptyObject, | |
| 32 | 32 | promisify, | |
| 33 | + deprecate, | ||
| 34 | + deprecateProperty, | ||
| 33 | 35 | } = require('internal/util'); | |
| 34 | 36 | ||
| 35 | 37 | assertCrypto(); | |
@@ -748,6 +750,11 @@ function onGoawayData(code, lastStreamID, buf) { | |||
| 748 | 750 | } | |
| 749 | 751 | } | |
| 750 | 752 | ||
| 753 | + // TODO(aduh95): remove this in future semver-major | ||
| 754 | + const deprecateWeight = deprecateProperty('weight', | ||
| 755 | + 'Priority signaling has been deprecated as of RFC 1993.', | ||
| 756 | + 'DEP0194'); | ||
| 757 | + | ||
| 751 | 758 | // When a ClientHttp2Session is first created, the socket may not yet be | |
| 752 | 759 | // connected. If request() is called during this time, the actual request | |
| 753 | 760 | // will be deferred until the socket is ready to go. | |
@@ -776,12 +783,14 @@ function requestOnConnect(headersList, headersParam, options) { | |||
| 776 | 783 | if (options.waitForTrailers) | |
| 777 | 784 | streamOptions |= STREAM_OPTION_GET_TRAILERS; | |
| 778 | 785 | ||
| 786 | + deprecateWeight(options); | ||
| 787 | + | ||
| 779 | 788 | // `ret` will be either the reserved stream ID (if positive) | |
| 780 | 789 | // or an error code (if negative) | |
| 781 | 790 | const ret = session[kHandle].request(headersList, | |
| 782 | 791 | streamOptions, | |
| 783 | 792 | options.parent | 0, | |
| 784 | - options.weight | 0, | ||
| 793 | + NGHTTP2_DEFAULT_WEIGHT, | ||
| 785 | 794 | !!options.exclusive); | |
| 786 | 795 | ||
| 787 | 796 | // In an error condition, one of three possible response codes will be | |
@@ -826,11 +835,7 @@ function requestOnConnect(headersList, headersParam, options) { | |||
| 826 | 835 | // | |
| 827 | 836 | // Also sets the default priority options if they are not set. | |
| 828 | 837 | const setAndValidatePriorityOptions = hideStackFrames((options) => { | |
| 829 | - if (options.weight === undefined) { | ||
| 830 | - options.weight = NGHTTP2_DEFAULT_WEIGHT; | ||
| 831 | - } else { | ||
| 832 | - validateNumber.withoutStackTrace(options.weight, 'options.weight'); | ||
| 833 | - } | ||
| 838 | + deprecateWeight(options); | ||
| 834 | 839 | ||
| 835 | 840 | if (options.parent === undefined) { | |
| 836 | 841 | options.parent = 0; | |
@@ -886,25 +891,6 @@ function submitSettings(settings, callback) { | |||
| 886 | 891 | } | |
| 887 | 892 | } | |
| 888 | 893 | ||
| 889 | - // Submits a PRIORITY frame to be sent to the remote peer | ||
| 890 | - // Note: If the silent option is true, the change will be made | ||
| 891 | - // locally with no PRIORITY frame sent. | ||
| 892 | - function submitPriority(options) { | ||
| 893 | - if (this.destroyed) | ||
| 894 | - return; | ||
| 895 | - this[kUpdateTimer](); | ||
| 896 | - | ||
| 897 | - // If the parent is the id, do nothing because a | ||
| 898 | - // stream cannot be made to depend on itself. | ||
| 899 | - if (options.parent === this[kID]) | ||
| 900 | - return; | ||
| 901 | - | ||
| 902 | - this[kHandle].priority(options.parent | 0, | ||
| 903 | - options.weight | 0, | ||
| 904 | - !!options.exclusive, | ||
| 905 | - !!options.silent); | ||
| 906 | - } | ||
| 907 | - | ||
| 908 | 894 | // Submit a GOAWAY frame to be sent to the remote peer. | |
| 909 | 895 | // If the lastStreamID is set to <= 0, then the lastProcStreamID will | |
| 910 | 896 | // be used. The opaqueData must either be a typed array or undefined | |
@@ -2314,25 +2300,6 @@ class Http2Stream extends Duplex { | |||
| 2314 | 2300 | } | |
| 2315 | 2301 | } | |
| 2316 | 2302 | ||
| 2317 | - priority(options) { | ||
| 2318 | - if (this.destroyed) | ||
| 2319 | - throw new ERR_HTTP2_INVALID_STREAM(); | ||
| 2320 | - | ||
| 2321 | - assertIsObject(options, 'options'); | ||
| 2322 | - options = { ...options }; | ||
| 2323 | - setAndValidatePriorityOptions(options); | ||
| 2324 | - | ||
| 2325 | - const priorityFn = submitPriority.bind(this, options); | ||
| 2326 | - | ||
| 2327 | - // If the handle has not yet been assigned, queue up the priority | ||
| 2328 | - // frame to be sent as soon as the ready event is emitted. | ||
| 2329 | - if (this.pending) { | ||
| 2330 | - this.once('ready', priorityFn); | ||
| 2331 | - return; | ||
| 2332 | - } | ||
| 2333 | - priorityFn(); | ||
| 2334 | - } | ||
| 2335 | - | ||
| 2336 | 2303 | sendTrailers(headers) { | |
| 2337 | 2304 | if (this.destroyed || this.closed) | |
| 2338 | 2305 | throw new ERR_HTTP2_INVALID_STREAM(); | |
@@ -2505,6 +2472,12 @@ class Http2Stream extends Duplex { | |||
| 2505 | 2472 | } | |
| 2506 | 2473 | } | |
| 2507 | 2474 | ||
| 2475 | + // TODO(aduh95): remove this in future semver-major | ||
| 2476 | + Http2Stream.prototype.priority = deprecate(function priority(options) { | ||
| 2477 | + if (this.destroyed) | ||
| 2478 | + throw new ERR_HTTP2_INVALID_STREAM(); | ||
| 2479 | + }, 'http2Stream.priority is longer supported after priority signalling was deprecated in RFC 1993', 'DEP0194'); | ||
| 2480 | + | ||
| 2508 | 2481 | function callTimeout(self, session) { | |
| 2509 | 2482 | // If the session is destroyed, this should never actually be invoked, | |
| 2510 | 2483 | // but just in case... | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -135,6 +135,17 @@ function isPendingDeprecation() { | |||
| 135 | 135 | !getOptionValue('--no-deprecation'); | |
| 136 | 136 | } | |
| 137 | 137 | ||
| 138 | + function deprecateProperty(key, msg, code, isPendingDeprecation) { | ||
| 139 | + const emitDeprecationWarning = getDeprecationWarningEmitter( | ||
| 140 | + code, msg, undefined, false, isPendingDeprecation, | ||
| 141 | + ); | ||
| 142 | + return (options) => { | ||
| 143 | + if (key in options) { | ||
| 144 | + emitDeprecationWarning(); | ||
| 145 | + } | ||
| 146 | + }; | ||
| 147 | + } | ||
| 148 | + | ||
| 138 | 149 | // Internal deprecator for pending --pending-deprecation. This can be invoked | |
| 139 | 150 | // at snapshot building time as the warning permission is only queried at | |
| 140 | 151 | // run time. | |
@@ -947,6 +958,7 @@ module.exports = { | |||
| 947 | 958 | defineReplaceableLazyAttribute, | |
| 948 | 959 | deprecate, | |
| 949 | 960 | deprecateInstantiation, | |
| 961 | + deprecateProperty, | ||
| 950 | 962 | emitExperimentalWarning, | |
| 951 | 963 | encodingsMap, | |
| 952 | 964 | exposeInterface, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -5,6 +5,11 @@ if (!common.hasCrypto) | |||
| 5 | 5 | common.skip('missing crypto'); | |
| 6 | 6 | const h2 = require('http2'); | |
| 7 | 7 | ||
| 8 | + common.expectWarning( | ||
| 9 | + 'DeprecationWarning', | ||
| 10 | + 'http2Stream.priority is longer supported after priority signalling was deprecated in RFC 1993', | ||
| 11 | + 'DEP0194'); | ||
| 12 | + | ||
| 8 | 13 | const server = h2.createServer(); | |
| 9 | 14 | ||
| 10 | 15 | // We use the lower-level API here | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -11,7 +11,6 @@ const http2 = require('http2'); | |||
| 11 | 11 | ||
| 12 | 12 | const optionsToTest = { | |
| 13 | 13 | endStream: 'boolean', | |
| 14 | - weight: 'number', | ||
| 15 | 14 | parent: 'number', | |
| 16 | 15 | exclusive: 'boolean', | |
| 17 | 16 | silent: 'boolean' | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -6,10 +6,16 @@ if (!common.hasCrypto) | |||
| 6 | 6 | const assert = require('assert'); | |
| 7 | 7 | const http2 = require('http2'); | |
| 8 | 8 | ||
| 9 | + common.expectWarning( | ||
| 10 | + 'DeprecationWarning', | ||
| 11 | + 'Priority signaling has been deprecated as of RFC 1993.', | ||
| 12 | + 'DEP0194'); | ||
| 13 | + | ||
| 9 | 14 | const checkWeight = (actual, expect) => { | |
| 10 | 15 | const server = http2.createServer(); | |
| 11 | 16 | server.on('stream', common.mustCall((stream, headers, flags) => { | |
| 12 | - assert.strictEqual(stream.state.weight, expect); | ||
| 17 | + assert.strictEqual(stream.state.sumDependencyWeight, 0); | ||
| 18 | + assert.strictEqual(stream.state.weight, 16); | ||
| 13 | 19 | stream.respond(); | |
| 14 | 20 | stream.end('test'); | |
| 15 | 21 | })); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -7,6 +7,11 @@ const assert = require('assert'); | |||
| 7 | 7 | const http2 = require('http2'); | |
| 8 | 8 | const Countdown = require('../common/countdown'); | |
| 9 | 9 | ||
| 10 | + common.expectWarning( | ||
| 11 | + 'DeprecationWarning', | ||
| 12 | + 'http2Stream.priority is longer supported after priority signalling was deprecated in RFC 1993', | ||
| 13 | + 'DEP0194'); | ||
| 14 | + | ||
| 10 | 15 | const server = http2.createServer(); | |
| 11 | 16 | const largeBuffer = Buffer.alloc(1e4); | |
| 12 | 17 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3,21 +3,18 @@ | |||
| 3 | 3 | const common = require('../common'); | |
| 4 | 4 | if (!common.hasCrypto) | |
| 5 | 5 | common.skip('missing crypto'); | |
| 6 | - const assert = require('assert'); | ||
| 7 | 6 | const h2 = require('http2'); | |
| 8 | 7 | ||
| 8 | + common.expectWarning( | ||
| 9 | + 'DeprecationWarning', | ||
| 10 | + 'http2Stream.priority is longer supported after priority signalling was deprecated in RFC 1993', | ||
| 11 | + 'DEP0194'); | ||
| 12 | + | ||
| 9 | 13 | const server = h2.createServer(); | |
| 10 | 14 | ||
| 11 | 15 | // We use the lower-level API here | |
| 12 | 16 | server.on('stream', common.mustCall(onStream)); | |
| 13 | 17 | ||
| 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 | - | ||
| 21 | 18 | function onStream(stream, headers, flags) { | |
| 22 | 19 | stream.priority({ | |
| 23 | 20 | parent: 0, | |
@@ -33,7 +30,7 @@ function onStream(stream, headers, flags) { | |||
| 33 | 30 | ||
| 34 | 31 | server.listen(0); | |
| 35 | 32 | ||
| 36 | - server.on('priority', common.mustCall(onPriority)); | ||
| 33 | + server.on('priority', common.mustNotCall()); | ||
| 37 | 34 | ||
| 38 | 35 | server.on('listening', common.mustCall(() => { | |
| 39 | 36 | ||
@@ -48,7 +45,9 @@ server.on('listening', common.mustCall(() => { | |||
| 48 | 45 | }); | |
| 49 | 46 | }); | |
| 50 | 47 | ||
| 51 | - req.on('priority', common.mustCall(onPriority)); | ||
| 48 | + // The priority event is not supported anymore by nghttp2 | ||
| 49 | + // since 1.65.0. | ||
| 50 | + req.on('priority', common.mustNotCall()); | ||
| 52 | 51 | ||
| 53 | 52 | req.on('response', common.mustCall()); | |
| 54 | 53 | req.resume(); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -6,6 +6,11 @@ if (!common.hasCrypto) | |||
| 6 | 6 | const assert = require('assert'); | |
| 7 | 7 | const h2 = require('http2'); | |
| 8 | 8 | ||
| 9 | + common.expectWarning( | ||
| 10 | + 'DeprecationWarning', | ||
| 11 | + 'http2Stream.priority is longer supported after priority signalling was deprecated in RFC 1993', | ||
| 12 | + 'DEP0194'); | ||
| 13 | + | ||
| 9 | 14 | const server = h2.createServer(); | |
| 10 | 15 | ||
| 11 | 16 | server.on('stream', common.mustCall((stream) => { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments