|
| 1 | +diff --git a/lib/internal/http2/core.js b/lib/internal/http2/core.js |
| 2 | +index cf7b06d987..369133dafb 100644 |
| 3 | +--- a/lib/internal/http2/core.js |
| 4 | ++++ b/lib/internal/http2/core.js |
| 5 | +@@ -30,2 +30,4 @@ const { |
| 6 | + promisify, |
| 7 | ++ deprecate, |
| 8 | ++ deprecateProperty, |
| 9 | + SymbolAsyncDispose, |
| 10 | +@@ -713,2 +715,7 @@ function onGoawayData(code, lastStreamID, buf) { |
| 11 | + |
| 12 | ++// TODO(aduh95): remove this in future semver-major |
| 13 | ++const deprecateWeight = deprecateProperty('weight', |
| 14 | ++ 'Priority signaling has been deprecated as of RFC 1993.', |
| 15 | ++ 'DEP0194'); |
| 16 | ++ |
| 17 | + // When a ClientHttp2Session is first created, the socket may not yet be |
| 18 | +@@ -741,2 +748,4 @@ function requestOnConnect(headers, options) { |
| 19 | + |
| 20 | ++ deprecateWeight(options); |
| 21 | ++ |
| 22 | + // `ret` will be either the reserved stream ID (if positive) |
| 23 | +@@ -746,3 +755,3 @@ function requestOnConnect(headers, options) { |
| 24 | + options.parent | 0, |
| 25 | +- options.weight | 0, |
| 26 | ++ NGHTTP2_DEFAULT_WEIGHT, |
| 27 | + !!options.exclusive); |
| 28 | +@@ -785,7 +794,3 @@ function requestOnConnect(headers, options) { |
| 29 | + const setAndValidatePriorityOptions = hideStackFrames((options) => { |
| 30 | +- if (options.weight === undefined) { |
| 31 | +- options.weight = NGHTTP2_DEFAULT_WEIGHT; |
| 32 | +- } else { |
| 33 | +- validateNumber.withoutStackTrace(options.weight, 'options.weight'); |
| 34 | +- } |
| 35 | ++ deprecateWeight(options); |
| 36 | + |
| 37 | +@@ -845,21 +850,2 @@ function submitSettings(settings, callback) { |
| 38 | + |
| 39 | +-// Submits a PRIORITY frame to be sent to the remote peer |
| 40 | +-// Note: If the silent option is true, the change will be made |
| 41 | +-// locally with no PRIORITY frame sent. |
| 42 | +-function submitPriority(options) { |
| 43 | +- if (this.destroyed) |
| 44 | +- return; |
| 45 | +- this[kUpdateTimer](); |
| 46 | +- |
| 47 | +- // If the parent is the id, do nothing because a |
| 48 | +- // stream cannot be made to depend on itself. |
| 49 | +- if (options.parent === this[kID]) |
| 50 | +- return; |
| 51 | +- |
| 52 | +- this[kHandle].priority(options.parent | 0, |
| 53 | +- options.weight | 0, |
| 54 | +- !!options.exclusive, |
| 55 | +- !!options.silent); |
| 56 | +-} |
| 57 | +- |
| 58 | + // Submit a GOAWAY frame to be sent to the remote peer. |
| 59 | +@@ -2255,21 +2241,2 @@ class Http2Stream extends Duplex { |
| 60 | + |
| 61 | +- priority(options) { |
| 62 | +- if (this.destroyed) |
| 63 | +- throw new ERR_HTTP2_INVALID_STREAM(); |
| 64 | +- |
| 65 | +- assertIsObject(options, 'options'); |
| 66 | +- options = { ...options }; |
| 67 | +- setAndValidatePriorityOptions(options); |
| 68 | +- |
| 69 | +- const priorityFn = submitPriority.bind(this, options); |
| 70 | +- |
| 71 | +- // If the handle has not yet been assigned, queue up the priority |
| 72 | +- // frame to be sent as soon as the ready event is emitted. |
| 73 | +- if (this.pending) { |
| 74 | +- this.once('ready', priorityFn); |
| 75 | +- return; |
| 76 | +- } |
| 77 | +- priorityFn(); |
| 78 | +- } |
| 79 | +- |
| 80 | + sendTrailers(headers) { |
| 81 | +@@ -2431,2 +2398,8 @@ class Http2Stream extends Duplex { |
| 82 | + |
| 83 | ++// TODO(aduh95): remove this in future semver-major |
| 84 | ++Http2Stream.prototype.priority = deprecate(function priority(options) { |
| 85 | ++ if (this.destroyed) |
| 86 | ++ throw new ERR_HTTP2_INVALID_STREAM(); |
| 87 | ++}, 'http2Stream.priority is longer supported after priority signalling was deprecated in RFC 1993', 'DEP0194'); |
| 88 | ++ |
| 89 | + function callTimeout(self, session) { |
| 90 | +diff --git a/lib/internal/util.js b/lib/internal/util.js |
| 91 | +index 254791eb48..2f12f5a3f1 100644 |
| 92 | +--- a/lib/internal/util.js |
| 93 | ++++ b/lib/internal/util.js |
| 94 | +@@ -135,2 +135,13 @@ function isPendingDeprecation() { |
| 95 | + |
| 96 | ++function deprecateProperty(key, msg, code, isPendingDeprecation) { |
| 97 | ++ const emitDeprecationWarning = getDeprecationWarningEmitter( |
| 98 | ++ code, msg, undefined, false, isPendingDeprecation, |
| 99 | ++ ); |
| 100 | ++ return (options) => { |
| 101 | ++ if (key in options) { |
| 102 | ++ emitDeprecationWarning(); |
| 103 | ++ } |
| 104 | ++ }; |
| 105 | ++} |
| 106 | ++ |
| 107 | + // Internal deprecator for pending --pending-deprecation. This can be invoked |
| 108 | +@@ -911,2 +922,3 @@ module.exports = { |
| 109 | + deprecate, |
| 110 | ++ deprecateProperty, |
| 111 | + emitExperimentalWarning, |
0 commit comments