%PDF- <> %âãÏÓ endobj 2 0 obj <> endobj 3 0 obj <>/ExtGState<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI] >>/Annots[ 28 0 R 29 0 R] /MediaBox[ 0 0 595.5 842.25] /Contents 4 0 R/Group<>/Tabs/S>> endobj ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<> endobj 2 0 obj<>endobj 2 0 obj<>es 3 0 R>> endobj 2 0 obj<> ox[ 0.000000 0.000000 609.600000 935.600000]/Fi endobj 3 0 obj<> endobj 7 1 obj<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI]>>/Subtype/Form>> stream
'use strict'; const common = require('../common'); 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 timeout = common.platformTimeout(100); const tests = []; function test(fn) { tests.push(fn); } 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 now passes if the same limit is 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', 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 is 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(); if (!fn) { return; } fn(() => { setTimeout(runTest, timeout); }); } runTest();