mirror of
https://github.com/d0zingcat/cors-anywhere.git
synced 2026-05-13 15:09:25 +00:00
Pass --max-http-header-size in supported versions only
This commit is contained in:
@@ -32,8 +32,19 @@ describe('memory usage', function() {
|
||||
// Uncomment this if you want to compare the performance of CORS Anywhere
|
||||
// with the standard no-op http module.
|
||||
// args.push('use-http-instead-of-cors-anywhere');
|
||||
var nodeOptionsArgs = ['--expose-gc'];
|
||||
var nodeMajorV = parseInt(process.versions.node, 10);
|
||||
// Node 11.3.0+, 10.14.0+, 8.14.0+, 6.15.0+ restrict header sizes
|
||||
// (CVE-2018-12121), and need to be passed the --max-http-header-size flag
|
||||
// to not reject large headers.
|
||||
if (nodeMajorV >= 11 ||
|
||||
nodeMajorV === 10 ||
|
||||
nodeMajorV === 8 ||
|
||||
nodeMajorV === 6) {
|
||||
nodeOptionsArgs.push('--max-http-header-size=60000');
|
||||
}
|
||||
cors_anywhere_child = fork(cors_module_path, args, {
|
||||
execArgv: ['--expose-gc', '--max-http-header-size=60000'],
|
||||
execArgv: nodeOptionsArgs,
|
||||
});
|
||||
cors_anywhere_child.once('message', function(cors_url) {
|
||||
cors_api_url = cors_url;
|
||||
|
||||
Reference in New Issue
Block a user