Skip to content

Commit

Permalink
test-memory: fix test by passing --max-http-header-size
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Rob--W committed May 2, 2020
1 parent 001fbef commit 2579fb6
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions test/test-memory.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 2579fb6

Please sign in to comment.