From 26269be510397a7dd5b81d5e59c12d53952d274f Mon Sep 17 00:00:00 2001 From: Adrian Estrada Date: Wed, 6 May 2020 10:40:01 -0500 Subject: [PATCH] benchmark: fixing http_server_for_chunky_client.js PR-URL: https://github.com/nodejs/node/pull/33271 Reviewed-By: Matteo Collina Reviewed-By: James M Snell Reviewed-By: Ruben Bridgewater --- benchmark/http/http_server_for_chunky_client.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/benchmark/http/http_server_for_chunky_client.js b/benchmark/http/http_server_for_chunky_client.js index ef0a23a02928ef..dafaf9122efc86 100644 --- a/benchmark/http/http_server_for_chunky_client.js +++ b/benchmark/http/http_server_for_chunky_client.js @@ -10,7 +10,9 @@ process.env.PIPE_NAME = PIPE; tmpdir.refresh(); -const server = http.createServer((req, res) => { +// For Node.js versions below v13.3.0 this benchmark will require +// the flag --max-http-header-size 64000 in order to work properly +const server = http.createServer({ maxHeaderSize: 64000 }, (req, res) => { const headers = { 'content-type': 'text/plain', 'content-length': '2' @@ -28,7 +30,11 @@ const child = fork( `${__dirname}/_chunky_http_client.js`, process.argv.slice(2) ); -child.on('message', common.sendResult); +child.on('message', (data) => { + if (data.type === 'report') { + common.sendResult(data); + } +}); child.on('close', (code) => { server.close(); assert.strictEqual(code, 0);