@@ -30,6 +30,8 @@ const {
3030 customInspectSymbol : kInspect ,
3131 kEmptyObject,
3232 promisify,
33+ deprecate,
34+ deprecateProperty,
3335} = require ( 'internal/util' ) ;
3436
3537assertCrypto ( ) ;
@@ -739,6 +741,11 @@ function onGoawayData(code, lastStreamID, buf) {
739741 }
740742}
741743
744+ // TODO(aduh95): remove this in future semver-major
745+ const deprecateWeight = deprecateProperty ( 'weight' ,
746+ 'Priority signaling has been deprecated as of RFC 1993.' ,
747+ 'DEP0194' ) ;
748+
742749// When a ClientHttp2Session is first created, the socket may not yet be
743750// connected. If request() is called during this time, the actual request
744751// will be deferred until the socket is ready to go.
@@ -767,12 +774,14 @@ function requestOnConnect(headersList, headersParam, options) {
767774 if ( options . waitForTrailers )
768775 streamOptions |= STREAM_OPTION_GET_TRAILERS ;
769776
777+ deprecateWeight ( options ) ;
778+
770779 // `ret` will be either the reserved stream ID (if positive)
771780 // or an error code (if negative)
772781 const ret = session [ kHandle ] . request ( headersList ,
773782 streamOptions ,
774783 options . parent | 0 ,
775- options . weight | 0 ,
784+ NGHTTP2_DEFAULT_WEIGHT ,
776785 ! ! options . exclusive ) ;
777786
778787 // In an error condition, one of three possible response codes will be
@@ -817,11 +826,7 @@ function requestOnConnect(headersList, headersParam, options) {
817826//
818827// Also sets the default priority options if they are not set.
819828const setAndValidatePriorityOptions = hideStackFrames ( ( options ) => {
820- if ( options . weight === undefined ) {
821- options . weight = NGHTTP2_DEFAULT_WEIGHT ;
822- } else {
823- validateNumber . withoutStackTrace ( options . weight , 'options.weight' ) ;
824- }
829+ deprecateWeight ( options ) ;
825830
826831 if ( options . parent === undefined ) {
827832 options . parent = 0 ;
@@ -877,25 +882,6 @@ function submitSettings(settings, callback) {
877882 }
878883}
879884
880- // Submits a PRIORITY frame to be sent to the remote peer
881- // Note: If the silent option is true, the change will be made
882- // locally with no PRIORITY frame sent.
883- function submitPriority ( options ) {
884- if ( this . destroyed )
885- return ;
886- this [ kUpdateTimer ] ( ) ;
887-
888- // If the parent is the id, do nothing because a
889- // stream cannot be made to depend on itself.
890- if ( options . parent === this [ kID ] )
891- return ;
892-
893- this [ kHandle ] . priority ( options . parent | 0 ,
894- options . weight | 0 ,
895- ! ! options . exclusive ,
896- ! ! options . silent ) ;
897- }
898-
899885// Submit a GOAWAY frame to be sent to the remote peer.
900886// If the lastStreamID is set to <= 0, then the lastProcStreamID will
901887// be used. The opaqueData must either be a typed array or undefined
@@ -2305,25 +2291,6 @@ class Http2Stream extends Duplex {
23052291 }
23062292 }
23072293
2308- priority ( options ) {
2309- if ( this . destroyed )
2310- throw new ERR_HTTP2_INVALID_STREAM ( ) ;
2311-
2312- assertIsObject ( options , 'options' ) ;
2313- options = { ...options } ;
2314- setAndValidatePriorityOptions ( options ) ;
2315-
2316- const priorityFn = submitPriority . bind ( this , options ) ;
2317-
2318- // If the handle has not yet been assigned, queue up the priority
2319- // frame to be sent as soon as the ready event is emitted.
2320- if ( this . pending ) {
2321- this . once ( 'ready' , priorityFn ) ;
2322- return ;
2323- }
2324- priorityFn ( ) ;
2325- }
2326-
23272294 sendTrailers ( headers ) {
23282295 if ( this . destroyed || this . closed )
23292296 throw new ERR_HTTP2_INVALID_STREAM ( ) ;
@@ -2489,6 +2456,12 @@ class Http2Stream extends Duplex {
24892456 }
24902457}
24912458
2459+ // TODO(aduh95): remove this in future semver-major
2460+ Http2Stream . prototype . priority = deprecate ( function priority ( options ) {
2461+ if ( this . destroyed )
2462+ throw new ERR_HTTP2_INVALID_STREAM ( ) ;
2463+ } , 'http2Stream.priority is longer supported after priority signalling was deprecated in RFC 1993' , 'DEP0194' ) ;
2464+
24922465function callTimeout ( self , session ) {
24932466 // If the session is destroyed, this should never actually be invoked,
24942467 // but just in case...
0 commit comments