File tree Expand file tree Collapse file tree 3 files changed +10
-6
lines changed Expand file tree Collapse file tree 3 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -612,7 +612,7 @@ class Parser {
612
612
// have been queued since then.
613
613
util . destroy ( socket , new InformationalError ( 'reset' ) )
614
614
return constants . ERROR . PAUSED
615
- } else if ( client [ kPipelining ] === 1 ) {
615
+ } else if ( client [ kPipelining ] == null || client [ kPipelining ] == = 1 ) {
616
616
// We must wait a full event loop cycle to reuse this socket to make sure
617
617
// that non-spec compliant servers are not closing the connection even if they
618
618
// said they won't.
@@ -735,6 +735,7 @@ async function connectH1 (client, socket) {
735
735
736
736
return {
737
737
version : 'h1' ,
738
+ defaultPipelining : 1 ,
738
739
write ( ...args ) {
739
740
return writeH1 ( client , ...args )
740
741
} ,
Original file line number Diff line number Diff line change @@ -124,6 +124,7 @@ async function connectH2 (client, socket) {
124
124
125
125
return {
126
126
version : 'h2' ,
127
+ defaultPipelining : Infinity ,
127
128
write ( ...args ) {
128
129
// TODO (fix): return
129
130
writeH2 ( client , ...args )
Original file line number Diff line number Diff line change @@ -66,6 +66,10 @@ const connectH2 = require('./client-h2.js')
66
66
67
67
const kClosedResolve = Symbol ( 'kClosedResolve' )
68
68
69
+ function getPipelining ( client ) {
70
+ return client [ kPipelining ] ?? client [ kHTTPContext ] ?. defaultPipelining ?? 1
71
+ }
72
+
69
73
/**
70
74
* @type {import('../../types/client.js').default }
71
75
*/
@@ -280,7 +284,7 @@ class Client extends DispatcherBase {
280
284
const socket = this [ kSocket ]
281
285
return (
282
286
( socket && ( socket [ kReset ] || socket [ kWriting ] || socket [ kBlocking ] ) ) ||
283
- ( this [ kSize ] >= ( this [ kPipelining ] || 1 ) ) ||
287
+ ( this [ kSize ] >= ( getPipelining ( this ) || 1 ) ) ||
284
288
this [ kPending ] > 0
285
289
)
286
290
}
@@ -564,10 +568,8 @@ function _resume (client, sync) {
564
568
return
565
569
}
566
570
567
- if ( client [ kHTTPContext ] ?. version === 'h1' ) {
568
- if ( client [ kRunning ] >= ( client [ kPipelining ] || 1 ) ) {
569
- return
570
- }
571
+ if ( client [ kRunning ] >= ( getPipelining ( client ) || 1 ) ) {
572
+ return
571
573
}
572
574
573
575
const request = client [ kQueue ] [ client [ kPendingIdx ] ]
You can’t perform that action at this time.
0 commit comments