@@ -30,6 +30,8 @@ const {
3030 customInspectSymbol : kInspect ,
3131 kEmptyObject,
3232 promisify,
33+ deprecate,
34+ deprecateProperty,
3335} = require ( 'internal/util' ) ;
3436
3537assertCrypto ( ) ;
@@ -747,6 +749,11 @@ function onGoawayData(code, lastStreamID, buf) {
747749 }
748750}
749751
752+ // TODO(aduh95): remove this in future semver-major
753+ const deprecateWeight = deprecateProperty ( 'weight' ,
754+ 'Priority signaling has been deprecated as of RFC 1993.' ,
755+ 'DEP0194' ) ;
756+
750757// When a ClientHttp2Session is first created, the socket may not yet be
751758// connected. If request() is called during this time, the actual request
752759// will be deferred until the socket is ready to go.
@@ -775,12 +782,14 @@ function requestOnConnect(headersList, headersParam, options) {
775782 if ( options . waitForTrailers )
776783 streamOptions |= STREAM_OPTION_GET_TRAILERS ;
777784
785+ deprecateWeight ( options ) ;
786+
778787 // `ret` will be either the reserved stream ID (if positive)
779788 // or an error code (if negative)
780789 const ret = session [ kHandle ] . request ( headersList ,
781790 streamOptions ,
782791 options . parent | 0 ,
783- options . weight | 0 ,
792+ NGHTTP2_DEFAULT_WEIGHT ,
784793 ! ! options . exclusive ) ;
785794
786795 // In an error condition, one of three possible response codes will be
@@ -825,11 +834,7 @@ function requestOnConnect(headersList, headersParam, options) {
825834//
826835// Also sets the default priority options if they are not set.
827836const setAndValidatePriorityOptions = hideStackFrames ( ( options ) => {
828- if ( options . weight === undefined ) {
829- options . weight = NGHTTP2_DEFAULT_WEIGHT ;
830- } else {
831- validateNumber . withoutStackTrace ( options . weight , 'options.weight' ) ;
832- }
837+ deprecateWeight ( options ) ;
833838
834839 if ( options . parent === undefined ) {
835840 options . parent = 0 ;
@@ -885,25 +890,6 @@ function submitSettings(settings, callback) {
885890 }
886891}
887892
888- // Submits a PRIORITY frame to be sent to the remote peer
889- // Note: If the silent option is true, the change will be made
890- // locally with no PRIORITY frame sent.
891- function submitPriority ( options ) {
892- if ( this . destroyed )
893- return ;
894- this [ kUpdateTimer ] ( ) ;
895-
896- // If the parent is the id, do nothing because a
897- // stream cannot be made to depend on itself.
898- if ( options . parent === this [ kID ] )
899- return ;
900-
901- this [ kHandle ] . priority ( options . parent | 0 ,
902- options . weight | 0 ,
903- ! ! options . exclusive ,
904- ! ! options . silent ) ;
905- }
906-
907893// Submit a GOAWAY frame to be sent to the remote peer.
908894// If the lastStreamID is set to <= 0, then the lastProcStreamID will
909895// be used. The opaqueData must either be a typed array or undefined
@@ -2313,25 +2299,6 @@ class Http2Stream extends Duplex {
23132299 }
23142300 }
23152301
2316- priority ( options ) {
2317- if ( this . destroyed )
2318- throw new ERR_HTTP2_INVALID_STREAM ( ) ;
2319-
2320- assertIsObject ( options , 'options' ) ;
2321- options = { ...options } ;
2322- setAndValidatePriorityOptions ( options ) ;
2323-
2324- const priorityFn = submitPriority . bind ( this , options ) ;
2325-
2326- // If the handle has not yet been assigned, queue up the priority
2327- // frame to be sent as soon as the ready event is emitted.
2328- if ( this . pending ) {
2329- this . once ( 'ready' , priorityFn ) ;
2330- return ;
2331- }
2332- priorityFn ( ) ;
2333- }
2334-
23352302 sendTrailers ( headers ) {
23362303 if ( this . destroyed || this . closed )
23372304 throw new ERR_HTTP2_INVALID_STREAM ( ) ;
@@ -2504,6 +2471,12 @@ class Http2Stream extends Duplex {
25042471 }
25052472}
25062473
2474+ // TODO(aduh95): remove this in future semver-major
2475+ Http2Stream . prototype . priority = deprecate ( function priority ( options ) {
2476+ if ( this . destroyed )
2477+ throw new ERR_HTTP2_INVALID_STREAM ( ) ;
2478+ } , 'http2Stream.priority is longer supported after priority signalling was deprecated in RFC 1993' , 'DEP0194' ) ;
2479+
25072480function callTimeout ( self , session ) {
25082481 // If the session is destroyed, this should never actually be invoked,
25092482 // but just in case...
0 commit comments