File tree Expand file tree Collapse file tree 3 files changed +35
-0
lines changed Expand file tree Collapse file tree 3 files changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -1805,6 +1805,16 @@ added: v0.5.9
18051805Global instance of ` Agent `  which is used as the default for all HTTP client
18061806requests.
18071807
1808+ ## http.maxHeaderSize  
1809+ <!--  YAML
1810+ added: REPLACEME 
1811+ --> 
1812+ 
1813+ *  {number}
1814+ 
1815+ Read-only property specifying the maximum allowed size of HTTP headers in bytes.
1816+ Defaults to 8KB. Configurable using the [ ` --max-http-header-size ` ] [ ]  CLI option.
1817+ 
18081818## http.request(options[ , callback] )  
18091819<!--  YAML
18101820added: v0.3.6 
@@ -1982,6 +1992,7 @@ will be emitted in the following order:
19821992Note that setting the ` timeout `  option or using the ` setTimeout `  function will
19831993not abort the request or do anything besides add a ` timeout `  event.
19841994
1995+ [ `--max-http-header-size` ] : cli.html#cli_max_http_header_size_size 
19851996[ `'checkContinue'` ] : #http_event_checkcontinue 
19861997[ `'request'` ] : #http_event_request 
19871998[ `'response'` ] : #http_event_response 
Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ const common = require('_http_common');
2727const  incoming  =  require ( '_http_incoming' ) ; 
2828const  outgoing  =  require ( '_http_outgoing' ) ; 
2929const  server  =  require ( '_http_server' ) ; 
30+ let  maxHeaderSize ; 
3031
3132const  {  Server }  =  server ; 
3233
@@ -59,3 +60,15 @@ module.exports = {
5960  get, 
6061  request
6162} ; 
63+ 
64+ Object . defineProperty ( module . exports ,  'maxHeaderSize' ,  { 
65+   configurable : true , 
66+   enumerable : true , 
67+   get ( )  { 
68+     if  ( maxHeaderSize  ===  undefined )  { 
69+       maxHeaderSize  =  process . binding ( 'config' ) . maxHTTPHeaderSize ; 
70+     } 
71+ 
72+     return  maxHeaderSize ; 
73+   } 
74+ } ) ; 
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