test-memory: fix test by passing --max-http-header-size

The test broke because Node lowered the maximum header size to defend
against large headers ( CVE-2018-12121 ).

In the test, we do actually want to pass large headers, because all
processing in CORS Anywhere is based on headers (the request body would
just be forwarded to the destination server).

The test failed intermittently with ECONNRESET or "socket hang up"
because the server (under test) would close the socket upon receiving
a request with too large request headers.
This commit is contained in:
Rob Wu
2020-05-02 19:20:08 +02:00
parent 001fbef926
commit 2579fb6c0d

View File

@@ -33,7 +33,7 @@ describe('memory usage', function() {
// with the standard no-op http module.
// args.push('use-http-instead-of-cors-anywhere');
cors_anywhere_child = fork(cors_module_path, args, {
execArgv: ['--expose-gc'],
execArgv: ['--expose-gc', '--max-http-header-size=60000'],
});
cors_anywhere_child.once('message', function(cors_url) {
cors_api_url = cors_url;
@@ -83,8 +83,7 @@ describe('memory usage', function() {
cors_anywhere_child.send(null);
return;
}
http.request(request, function(res) {
res.destroy();
http.request(request, function() {
requestAgain();
}).on('error', function(error) {
done(error);