@@ -30,6 +30,8 @@ const {
3030 customInspectSymbol : kInspect ,
3131 kEmptyObject,
3232 promisify,
33+ deprecate,
34+ deprecateProperty,
3335} = require ( 'internal/util' ) ;
3436
3537assertCrypto ( ) ;
@@ -746,6 +748,11 @@ function onGoawayData(code, lastStreamID, buf) {
746748 }
747749}
748750
751+ // TODO(aduh95): remove this in future semver-major
752+ const deprecateWeight = deprecateProperty ( 'weight' ,
753+ 'Priority signaling has been deprecated as of RFC 1993.' ,
754+ 'DEP0194' ) ;
755+
749756// When a ClientHttp2Session is first created, the socket may not yet be
750757// connected. If request() is called during this time, the actual request
751758// will be deferred until the socket is ready to go.
@@ -774,12 +781,14 @@ function requestOnConnect(headersList, headersParam, options) {
774781 if ( options . waitForTrailers )
775782 streamOptions |= STREAM_OPTION_GET_TRAILERS ;
776783
784+ deprecateWeight ( options ) ;
785+
777786 // `ret` will be either the reserved stream ID (if positive)
778787 // or an error code (if negative)
779788 const ret = session [ kHandle ] . request ( headersList ,
780789 streamOptions ,
781790 options . parent | 0 ,
782- options . weight | 0 ,
791+ NGHTTP2_DEFAULT_WEIGHT ,
783792 ! ! options . exclusive ) ;
784793
785794 // In an error condition, one of three possible response codes will be
@@ -824,11 +833,7 @@ function requestOnConnect(headersList, headersParam, options) {
824833//
825834// Also sets the default priority options if they are not set.
826835const setAndValidatePriorityOptions = hideStackFrames ( ( options ) => {
827- if ( options . weight === undefined ) {
828- options . weight = NGHTTP2_DEFAULT_WEIGHT ;
829- } else {
830- validateNumber . withoutStackTrace ( options . weight , 'options.weight' ) ;
831- }
836+ deprecateWeight ( options ) ;
832837
833838 if ( options . parent === undefined ) {
834839 options . parent = 0 ;
@@ -884,25 +889,6 @@ function submitSettings(settings, callback) {
884889 }
885890}
886891
887- // Submits a PRIORITY frame to be sent to the remote peer
888- // Note: If the silent option is true, the change will be made
889- // locally with no PRIORITY frame sent.
890- function submitPriority ( options ) {
891- if ( this . destroyed )
892- return ;
893- this [ kUpdateTimer ] ( ) ;
894-
895- // If the parent is the id, do nothing because a
896- // stream cannot be made to depend on itself.
897- if ( options . parent === this [ kID ] )
898- return ;
899-
900- this [ kHandle ] . priority ( options . parent | 0 ,
901- options . weight | 0 ,
902- ! ! options . exclusive ,
903- ! ! options . silent ) ;
904- }
905-
906892// Submit a GOAWAY frame to be sent to the remote peer.
907893// If the lastStreamID is set to <= 0, then the lastProcStreamID will
908894// be used. The opaqueData must either be a typed array or undefined
@@ -2312,25 +2298,6 @@ class Http2Stream extends Duplex {
23122298 }
23132299 }
23142300
2315- priority ( options ) {
2316- if ( this . destroyed )
2317- throw new ERR_HTTP2_INVALID_STREAM ( ) ;
2318-
2319- assertIsObject ( options , 'options' ) ;
2320- options = { ...options } ;
2321- setAndValidatePriorityOptions ( options ) ;
2322-
2323- const priorityFn = submitPriority . bind ( this , options ) ;
2324-
2325- // If the handle has not yet been assigned, queue up the priority
2326- // frame to be sent as soon as the ready event is emitted.
2327- if ( this . pending ) {
2328- this . once ( 'ready' , priorityFn ) ;
2329- return ;
2330- }
2331- priorityFn ( ) ;
2332- }
2333-
23342301 sendTrailers ( headers ) {
23352302 if ( this . destroyed || this . closed )
23362303 throw new ERR_HTTP2_INVALID_STREAM ( ) ;
@@ -2496,6 +2463,12 @@ class Http2Stream extends Duplex {
24962463 }
24972464}
24982465
2466+ // TODO(aduh95): remove this in future semver-major
2467+ Http2Stream . prototype . priority = deprecate ( function priority ( options ) {
2468+ if ( this . destroyed )
2469+ throw new ERR_HTTP2_INVALID_STREAM ( ) ;
2470+ } , 'http2Stream.priority is longer supported after priority signalling was deprecated in RFC 1993' , 'DEP0194' ) ;
2471+
24992472function callTimeout ( self , session ) {
25002473 // If the session is destroyed, this should never actually be invoked,
25012474 // but just in case...
0 commit comments