File tree 3 files changed +36
-0
lines changed
3 files changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -1894,6 +1894,16 @@ added: v0.5.9
1894
1894
Global instance of ` Agent ` which is used as the default for all HTTP client
1895
1895
requests.
1896
1896
1897
+ ## http.maxHeaderSize
1898
+ <!-- YAML
1899
+ added: REPLACEME
1900
+ -->
1901
+
1902
+ * {number}
1903
+
1904
+ Read-only property specifying the maximum allowed size of HTTP headers in bytes.
1905
+ Defaults to 8KB. Configurable using the [ ` --max-http-header-size ` ] [ ] CLI option.
1906
+
1897
1907
## http.request(options[ , callback] )
1898
1908
## http.request(url[ , options] [ , callback ] )
1899
1909
<!-- YAML
@@ -2079,6 +2089,7 @@ will be emitted in the following order:
2079
2089
Note that setting the ` timeout ` option or using the ` setTimeout() ` function will
2080
2090
not abort the request or do anything besides add a ` 'timeout' ` event.
2081
2091
2092
+ [ `--max-http-header-size` ] : cli.html#cli_max_http_header_size_size
2082
2093
[ `'checkContinue'` ] : #http_event_checkcontinue
2083
2094
[ `'request'` ] : #http_event_request
2084
2095
[ `'response'` ] : #http_event_response
Original file line number Diff line number Diff line change @@ -32,6 +32,7 @@ const {
32
32
Server,
33
33
ServerResponse
34
34
} = require ( '_http_server' ) ;
35
+ let maxHeaderSize ;
35
36
36
37
function createServer ( opts , requestListener ) {
37
38
return new Server ( opts , requestListener ) ;
@@ -62,3 +63,16 @@ module.exports = {
62
63
get,
63
64
request
64
65
} ;
66
+
67
+ Object . defineProperty ( module . exports , 'maxHeaderSize' , {
68
+ configurable : true ,
69
+ enumerable : true ,
70
+ get ( ) {
71
+ if ( maxHeaderSize === undefined ) {
72
+ const { getOptionValue } = require ( 'internal/options' ) ;
73
+ maxHeaderSize = getOptionValue ( '--max-http-header-size' ) ;
74
+ }
75
+
76
+ return maxHeaderSize ;
77
+ }
78
+ } ) ;
Original file line number Diff line number Diff line change
1
+ 'use strict' ;
2
+
3
+ require ( '../common' ) ;
4
+ const assert = require ( 'assert' ) ;
5
+ const { spawnSync } = require ( 'child_process' ) ;
6
+ const http = require ( 'http' ) ;
7
+
8
+ assert . strictEqual ( http . maxHeaderSize , 8 * 1024 ) ;
9
+ const child = spawnSync ( process . execPath , [ '--max-http-header-size=10' , '-p' ,
10
+ 'http.maxHeaderSize' ] ) ;
11
+ assert . strictEqual ( + child . stdout . toString ( ) . trim ( ) , 10 ) ;
You can’t perform that action at this time.
0 commit comments