Skip to content

Commit 8311677

Browse files
committed
build: make HTTP_MAX_HEADER_SIZE configurable
The maximum size of headers introduced in the security release of 2018/11/27 is not configurable. This change adds a --http-max-header-size option to ./configure. See: #24693
1 parent 171b810 commit 8311677

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

configure.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,11 @@
189189
dest='experimental_http_parser',
190190
help='use llhttp instead of http_parser')
191191

192+
parser.add_option('--http-max-header-size',
193+
action='store',
194+
default='8192',
195+
help='set the max size of HTTP headers [default: %default]')
196+
192197
shared_optgroup.add_option('--shared-http-parser',
193198
action='store_true',
194199
dest='shared_http_parser',
@@ -1594,7 +1599,11 @@ def make_bin_override():
15941599

15951600
configure_node(output)
15961601
configure_library('zlib', output)
1602+
1603+
# configure http_parser
15971604
configure_library('http_parser', output)
1605+
output['variables']['http_max_header_size'] = options.http_max_header_size
1606+
15981607
configure_library('libuv', output)
15991608
configure_library('libcares', output)
16001609
configure_library('nghttp2', output)

deps/http_parser/http_parser.gyp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@
4747
],
4848
},
4949

50+
'variables': {
51+
'http_max_header_size%': '8192'
52+
},
53+
5054
'targets': [
5155
{
5256
'target_name': 'http_parser',
@@ -56,7 +60,7 @@
5660
'defines': [ 'HTTP_PARSER_STRICT=0' ],
5761
'include_dirs': [ '.' ],
5862
},
59-
'defines': [ 'HTTP_MAX_HEADER_SIZE=8192', 'HTTP_PARSER_STRICT=0' ],
63+
'defines': [ 'HTTP_MAX_HEADER_SIZE=<(http_max_header_size)', 'HTTP_PARSER_STRICT=0' ],
6064
'sources': [ './http_parser.c', ],
6165
'conditions': [
6266
['OS=="win"', {
@@ -79,7 +83,7 @@
7983
'defines': [ 'HTTP_PARSER_STRICT=1' ],
8084
'include_dirs': [ '.' ],
8185
},
82-
'defines': [ 'HTTP_MAX_HEADER_SIZE=8192', 'HTTP_PARSER_STRICT=1' ],
86+
'defines': [ 'HTTP_MAX_HEADER_SIZE=<(http_max_header_size)', 'HTTP_PARSER_STRICT=1' ],
8387
'sources': [ './http_parser.c', ],
8488
'conditions': [
8589
['OS=="win"', {

node.gypi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
# all obj files in static libs into the executable or shared lib.
99
'variables': {
1010
'variables': {
11+
'http_max_header_size%': 8192,
1112
'variables': {
1213
'force_load%': 'true',
1314
'current_type%': '<(_type)',
@@ -168,6 +169,7 @@
168169
'dependencies': [ 'deps/llhttp/llhttp.gyp:llhttp' ],
169170
}, {
170171
'conditions': [ [ 'node_shared_http_parser=="false"', {
172+
'defines': [ 'HTTP_MAX_HEADER_SIZE=<(http_max_header_size)' ],
171173
'dependencies': [ 'deps/http_parser/http_parser.gyp:http_parser' ],
172174
} ] ],
173175
} ],

0 commit comments

Comments
 (0)