aboutsummaryrefslogtreecommitdiff
path: root/test/sequential/test-set-http-max-http-headers.js
diff options
context:
space:
mode:
authorAnna Henningsen <anna@addaleax.net>2019-09-17 14:17:08 +0200
committerAnna Henningsen <anna@addaleax.net>2019-09-20 20:18:35 +0200
commitac59dc42edb721ede2e5ddc6d1e4945ee2bf1e9c (patch)
treeb73ea409a56d4efc04dc452713d46222faed1d05 /test/sequential/test-set-http-max-http-headers.js
parentba3be578d8bbca1bafc391984b0e6f037507dcbc (diff)
downloadandroid-node-v8-ac59dc42edb721ede2e5ddc6d1e4945ee2bf1e9c.tar.gz
android-node-v8-ac59dc42edb721ede2e5ddc6d1e4945ee2bf1e9c.tar.bz2
android-node-v8-ac59dc42edb721ede2e5ddc6d1e4945ee2bf1e9c.zip
http: remove legacy parser
Remove the legacy `http_parser` implementation as a dependency and all code that uses it in favor of llhttp, given that the latter has been the default for all of Node 12 with no outstanding issues. PR-URL: https://github.com/nodejs/node/pull/29589 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Minwoo Jung <minwoo@nodesource.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Diffstat (limited to 'test/sequential/test-set-http-max-http-headers.js')
-rw-r--r--test/sequential/test-set-http-max-http-headers.js113
1 files changed, 54 insertions, 59 deletions
diff --git a/test/sequential/test-set-http-max-http-headers.js b/test/sequential/test-set-http-max-http-headers.js
index 81d9d308b9..cfe1ed6953 100644
--- a/test/sequential/test-set-http-max-http-headers.js
+++ b/test/sequential/test-set-http-max-http-headers.js
@@ -5,7 +5,6 @@ const assert = require('assert');
const { spawn } = require('child_process');
const path = require('path');
const testName = path.join(__dirname, 'test-http-max-http-headers.js');
-const parsers = ['legacy', 'llhttp'];
const timeout = common.platformTimeout(100);
@@ -15,16 +14,59 @@ function test(fn) {
tests.push(fn);
}
-parsers.forEach((parser) => {
+test(function(cb) {
+ console.log('running subtest expecting failure');
+
+ // Validate that the test fails if the max header size is too small.
+ const args = ['--expose-internals',
+ '--max-http-header-size=1024',
+ testName];
+ const cp = spawn(process.execPath, args, { stdio: 'inherit' });
+
+ cp.on('close', common.mustCall((code, signal) => {
+ assert.strictEqual(code, 1);
+ assert.strictEqual(signal, null);
+ cb();
+ }));
+});
+
+test(function(cb) {
+ console.log('running subtest expecting success');
+
+ const env = Object.assign({}, process.env, {
+ NODE_DEBUG: 'http'
+ });
+
+ // Validate that the test fails if the max header size is too small.
+ // Validate that the test now passes if the same limit becomes large enough.
+ const args = ['--expose-internals',
+ '--max-http-header-size=1024',
+ testName,
+ '1024'];
+ const cp = spawn(process.execPath, args, {
+ env,
+ stdio: 'inherit'
+ });
+
+ cp.on('close', common.mustCall((code, signal) => {
+ assert.strictEqual(code, 0);
+ assert.strictEqual(signal, null);
+ cb();
+ }));
+});
+
+// Next, repeat the same checks using NODE_OPTIONS if it is supported.
+if (!process.config.variables.node_without_node_options) {
+ const env = Object.assign({}, process.env, {
+ NODE_OPTIONS: '--max-http-header-size=1024'
+ });
+
test(function(cb) {
console.log('running subtest expecting failure');
// Validate that the test fails if the max header size is too small.
- const args = ['--expose-internals',
- `--http-parser=${parser}`,
- '--max-http-header-size=1024',
- testName];
- const cp = spawn(process.execPath, args, { stdio: 'inherit' });
+ const args = ['--expose-internals', testName];
+ const cp = spawn(process.execPath, args, { env, stdio: 'inherit' });
cp.on('close', common.mustCall((code, signal) => {
assert.strictEqual(code, 1);
@@ -34,23 +76,10 @@ parsers.forEach((parser) => {
});
test(function(cb) {
- console.log('running subtest expecting success');
-
- const env = Object.assign({}, process.env, {
- NODE_DEBUG: 'http'
- });
-
- // Validate that the test fails if the max header size is too small.
- // Validate that the test now passes if the same limit becomes large enough.
- const args = ['--expose-internals',
- `--http-parser=${parser}`,
- '--max-http-header-size=1024',
- testName,
- '1024'];
- const cp = spawn(process.execPath, args, {
- env,
- stdio: 'inherit'
- });
+ // Validate that the test now passes if the same limit
+ // becomes large enough.
+ const args = ['--expose-internals', testName, '1024'];
+ const cp = spawn(process.execPath, args, { env, stdio: 'inherit' });
cp.on('close', common.mustCall((code, signal) => {
assert.strictEqual(code, 0);
@@ -58,41 +87,7 @@ parsers.forEach((parser) => {
cb();
}));
});
-
- // Next, repeat the same checks using NODE_OPTIONS if it is supported.
- if (!process.config.variables.node_without_node_options) {
- const env = Object.assign({}, process.env, {
- NODE_OPTIONS: `--http-parser=${parser} --max-http-header-size=1024`
- });
-
- test(function(cb) {
- console.log('running subtest expecting failure');
-
- // Validate that the test fails if the max header size is too small.
- const args = ['--expose-internals', testName];
- const cp = spawn(process.execPath, args, { env, stdio: 'inherit' });
-
- cp.on('close', common.mustCall((code, signal) => {
- assert.strictEqual(code, 1);
- assert.strictEqual(signal, null);
- cb();
- }));
- });
-
- test(function(cb) {
- // Validate that the test now passes if the same limit
- // becomes large enough.
- const args = ['--expose-internals', testName, '1024'];
- const cp = spawn(process.execPath, args, { env, stdio: 'inherit' });
-
- cp.on('close', common.mustCall((code, signal) => {
- assert.strictEqual(code, 0);
- assert.strictEqual(signal, null);
- cb();
- }));
- });
- }
-});
+}
function runTest() {
const fn = tests.shift();