@@ -30,6 +30,8 @@ const {
30
30
customInspectSymbol : kInspect ,
31
31
kEmptyObject,
32
32
promisify,
33
+ deprecate,
34
+ deprecateProperty,
33
35
} = require ( 'internal/util' ) ;
34
36
35
37
assertCrypto ( ) ;
@@ -748,6 +750,11 @@ function onGoawayData(code, lastStreamID, buf) {
748
750
}
749
751
}
750
752
753
+ // 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
+
751
758
// When a ClientHttp2Session is first created, the socket may not yet be
752
759
// connected. If request() is called during this time, the actual request
753
760
// will be deferred until the socket is ready to go.
@@ -776,12 +783,14 @@ function requestOnConnect(headersList, headersParam, options) {
776
783
if ( options . waitForTrailers )
777
784
streamOptions |= STREAM_OPTION_GET_TRAILERS ;
778
785
786
+ deprecateWeight ( options ) ;
787
+
779
788
// `ret` will be either the reserved stream ID (if positive)
780
789
// or an error code (if negative)
781
790
const ret = session [ kHandle ] . request ( headersList ,
782
791
streamOptions ,
783
792
options . parent | 0 ,
784
- options . weight | 0 ,
793
+ NGHTTP2_DEFAULT_WEIGHT ,
785
794
! ! options . exclusive ) ;
786
795
787
796
// In an error condition, one of three possible response codes will be
@@ -826,11 +835,7 @@ function requestOnConnect(headersList, headersParam, options) {
826
835
//
827
836
// Also sets the default priority options if they are not set.
828
837
const 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 ) ;
834
839
835
840
if ( options . parent === undefined ) {
836
841
options . parent = 0 ;
@@ -886,25 +891,6 @@ function submitSettings(settings, callback) {
886
891
}
887
892
}
888
893
889
- // 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
-
908
894
// Submit a GOAWAY frame to be sent to the remote peer.
909
895
// If the lastStreamID is set to <= 0, then the lastProcStreamID will
910
896
// be used. The opaqueData must either be a typed array or undefined
@@ -2314,25 +2300,6 @@ class Http2Stream extends Duplex {
2314
2300
}
2315
2301
}
2316
2302
2317
- 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
-
2336
2303
sendTrailers ( headers ) {
2337
2304
if ( this . destroyed || this . closed )
2338
2305
throw new ERR_HTTP2_INVALID_STREAM ( ) ;
@@ -2505,6 +2472,12 @@ class Http2Stream extends Duplex {
2505
2472
}
2506
2473
}
2507
2474
2475
+ // 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
+
2508
2481
function callTimeout ( self , session ) {
2509
2482
// If the session is destroyed, this should never actually be invoked,
2510
2483
// but just in case...
0 commit comments