@@ -30,6 +30,8 @@ const {
3030 promisify,
3131 SymbolAsyncDispose,
3232 SymbolDispose,
33+ deprecate,
34+ deprecateProperty,
3335} = require ( 'internal/util' ) ;
3436
3537assertCrypto ( ) ;
@@ -752,6 +754,11 @@ function onGoawayData(code, lastStreamID, buf) {
752754 }
753755}
754756
757+ // TODO(aduh95): remove this in future semver-major
758+ const deprecateWeight = deprecateProperty ( 'weight' ,
759+ 'Priority signaling has been deprecated as of RFC 1993.' ,
760+ 'DEP0194' ) ;
761+
755762// When a ClientHttp2Session is first created, the socket may not yet be
756763// connected. If request() is called during this time, the actual request
757764// will be deferred until the socket is ready to go.
@@ -780,12 +787,14 @@ function requestOnConnect(headersList, options) {
780787 if ( options . waitForTrailers )
781788 streamOptions |= STREAM_OPTION_GET_TRAILERS ;
782789
790+ deprecateWeight ( options ) ;
791+
783792 // `ret` will be either the reserved stream ID (if positive)
784793 // or an error code (if negative)
785794 const ret = session [ kHandle ] . request ( headersList ,
786795 streamOptions ,
787796 options . parent | 0 ,
788- options . weight | 0 ,
797+ NGHTTP2_DEFAULT_WEIGHT ,
789798 ! ! options . exclusive ) ;
790799
791800 // In an error condition, one of three possible response codes will be
@@ -830,11 +839,7 @@ function requestOnConnect(headersList, options) {
830839//
831840// Also sets the default priority options if they are not set.
832841const setAndValidatePriorityOptions = hideStackFrames ( ( options ) => {
833- if ( options . weight === undefined ) {
834- options . weight = NGHTTP2_DEFAULT_WEIGHT ;
835- } else {
836- validateNumber . withoutStackTrace ( options . weight , 'options.weight' ) ;
837- }
842+ deprecateWeight ( options ) ;
838843
839844 if ( options . parent === undefined ) {
840845 options . parent = 0 ;
@@ -890,25 +895,6 @@ function submitSettings(settings, callback) {
890895 }
891896}
892897
893- // Submits a PRIORITY frame to be sent to the remote peer
894- // Note: If the silent option is true, the change will be made
895- // locally with no PRIORITY frame sent.
896- function submitPriority ( options ) {
897- if ( this . destroyed )
898- return ;
899- this [ kUpdateTimer ] ( ) ;
900-
901- // If the parent is the id, do nothing because a
902- // stream cannot be made to depend on itself.
903- if ( options . parent === this [ kID ] )
904- return ;
905-
906- this [ kHandle ] . priority ( options . parent | 0 ,
907- options . weight | 0 ,
908- ! ! options . exclusive ,
909- ! ! options . silent ) ;
910- }
911-
912898// Submit a GOAWAY frame to be sent to the remote peer.
913899// If the lastStreamID is set to <= 0, then the lastProcStreamID will
914900// be used. The opaqueData must either be a typed array or undefined
@@ -2357,25 +2343,6 @@ class Http2Stream extends Duplex {
23572343 }
23582344 }
23592345
2360- priority ( options ) {
2361- if ( this . destroyed )
2362- throw new ERR_HTTP2_INVALID_STREAM ( ) ;
2363-
2364- assertIsObject ( options , 'options' ) ;
2365- options = { ...options } ;
2366- setAndValidatePriorityOptions ( options ) ;
2367-
2368- const priorityFn = submitPriority . bind ( this , options ) ;
2369-
2370- // If the handle has not yet been assigned, queue up the priority
2371- // frame to be sent as soon as the ready event is emitted.
2372- if ( this . pending ) {
2373- this . once ( 'ready' , priorityFn ) ;
2374- return ;
2375- }
2376- priorityFn ( ) ;
2377- }
2378-
23792346 sendTrailers ( headers ) {
23802347 if ( this . destroyed || this . closed )
23812348 throw new ERR_HTTP2_INVALID_STREAM ( ) ;
@@ -2548,6 +2515,12 @@ class Http2Stream extends Duplex {
25482515 }
25492516}
25502517
2518+ // TODO(aduh95): remove this in future semver-major
2519+ Http2Stream . prototype . priority = deprecate ( function priority ( options ) {
2520+ if ( this . destroyed )
2521+ throw new ERR_HTTP2_INVALID_STREAM ( ) ;
2522+ } , 'http2Stream.priority is longer supported after priority signalling was deprecated in RFC 1993' , 'DEP0194' ) ;
2523+
25512524function callTimeout ( self , session ) {
25522525 // If the session is destroyed, this should never actually be invoked,
25532526 // but just in case...
0 commit comments