http2: remove support for priority signaling · nodejs/node@0b987e5
@@ -30,6 +30,8 @@ const {
3030customInspectSymbol: kInspect,
3131 kEmptyObject,
3232 promisify,
33+ deprecate,
34+ deprecateProperty,
3335} = require('internal/util');
34363537assertCrypto();
@@ -748,6 +750,11 @@ function onGoawayData(code, lastStreamID, buf) {
748750}
749751}
750752753+// 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+751758// When a ClientHttp2Session is first created, the socket may not yet be
752759// connected. If request() is called during this time, the actual request
753760// will be deferred until the socket is ready to go.
@@ -776,12 +783,14 @@ function requestOnConnect(headersList, headersParam, options) {
776783if (options.waitForTrailers)
777784streamOptions |= STREAM_OPTION_GET_TRAILERS;
778785786+deprecateWeight(options);
787+779788// `ret` will be either the reserved stream ID (if positive)
780789// or an error code (if negative)
781790const ret = session[kHandle].request(headersList,
782791streamOptions,
783792options.parent | 0,
784-options.weight | 0,
793+NGHTTP2_DEFAULT_WEIGHT,
785794!!options.exclusive);
786795787796// In an error condition, one of three possible response codes will be
@@ -826,11 +835,7 @@ function requestOnConnect(headersList, headersParam, options) {
826835//
827836// Also sets the default priority options if they are not set.
828837const 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);
834839835840if (options.parent === undefined) {
836841options.parent = 0;
@@ -886,25 +891,6 @@ function submitSettings(settings, callback) {
886891}
887892}
888893889-// 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-908894// Submit a GOAWAY frame to be sent to the remote peer.
909895// If the lastStreamID is set to <= 0, then the lastProcStreamID will
910896// be used. The opaqueData must either be a typed array or undefined
@@ -2314,25 +2300,6 @@ class Http2Stream extends Duplex {
23142300}
23152301}
231623022317-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-23362303sendTrailers(headers) {
23372304if (this.destroyed || this.closed)
23382305throw new ERR_HTTP2_INVALID_STREAM();
@@ -2505,6 +2472,12 @@ class Http2Stream extends Duplex {
25052472}
25062473}
250724742475+// 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+25082481function callTimeout(self, session) {
25092482// If the session is destroyed, this should never actually be invoked,
25102483// but just in case...