File tree 3 files changed +25
-2
lines changed 3 files changed +25
-2
lines changed Original file line number Diff line number Diff line change @@ -3633,6 +3633,16 @@ try {
3633
3633
}
3634
3634
```
3635
3635
3636
+ ## ` http.setMaxIdleHTTPParsers `
3637
+
3638
+ <!-- YAML
3639
+ added: REPLACEME
3640
+ -->
3641
+
3642
+ * {number}
3643
+
3644
+ Set the maximum number of idle HTTP parsers. ** Default:** ` 1000 ` .
3645
+
3636
3646
[ RFC 8187 ] : https://www.rfc-editor.org/rfc/rfc8187.txt
3637
3647
[ `'checkContinue'` ] : #event-checkcontinue
3638
3648
[ `'finish'` ] : #event-finish
Original file line number Diff line number Diff line change @@ -27,9 +27,10 @@ const {
27
27
ObjectDefineProperty,
28
28
} = primordials ;
29
29
30
+ const { validateInteger } = require ( 'internal/validators' ) ;
30
31
const httpAgent = require ( '_http_agent' ) ;
31
32
const { ClientRequest } = require ( '_http_client' ) ;
32
- const { methods } = require ( '_http_common' ) ;
33
+ const { methods, parsers } = require ( '_http_common' ) ;
33
34
const { IncomingMessage } = require ( '_http_incoming' ) ;
34
35
const {
35
36
validateHeaderName,
@@ -123,7 +124,11 @@ module.exports = {
123
124
validateHeaderName,
124
125
validateHeaderValue,
125
126
get,
126
- request
127
+ request,
128
+ setMaxIdleHTTPParsers ( max ) {
129
+ validateInteger ( max , 'max' ) ;
130
+ parsers . max = max ;
131
+ }
127
132
} ;
128
133
129
134
ObjectDefineProperty ( module . exports , 'maxHeaderSize' , {
Original file line number Diff line number Diff line change
1
+ 'use strict' ;
2
+ require ( '../common' ) ;
3
+ const assert = require ( 'assert' ) ;
4
+ const httpCommon = require ( '_http_common' ) ;
5
+ const http = require ( 'http' ) ;
6
+ assert . strictEqual ( httpCommon . parsers . max !== 1 , true ) ;
7
+ http . setMaxIdleHTTPParsers ( 1 ) ;
8
+ assert . strictEqual ( httpCommon . parsers . max , 1 ) ;
You can’t perform that action at this time.
0 commit comments