%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
// Flags: --expose-internals 'use strict'; const { expectsError, mustCall } = require('../common'); const assert = require('assert'); const { createServer, maxHeaderSize } = require('http'); const { createConnection } = require('net'); const CRLF = '\r\n'; const DUMMY_HEADER_NAME = 'Cookie: '; const DUMMY_HEADER_VALUE = 'a'.repeat( // Plus one is to make it 1 byte too big maxHeaderSize - DUMMY_HEADER_NAME.length + 2 ); const PAYLOAD_GET = 'GET /blah HTTP/1.1'; const PAYLOAD = PAYLOAD_GET + CRLF + DUMMY_HEADER_NAME + DUMMY_HEADER_VALUE + CRLF.repeat(2); const server = createServer(); server.on('connection', mustCall((socket) => { socket.on('error', expectsError({ name: 'Error', message: 'Parse Error: Header overflow', code: 'HPE_HEADER_OVERFLOW', bytesParsed: maxHeaderSize + PAYLOAD_GET.length + (CRLF.length * 2) + 1, rawPacket: Buffer.from(PAYLOAD) })); })); server.listen(0, mustCall(() => { const c = createConnection(server.address().port); let received = ''; c.on('connect', mustCall(() => { c.write(PAYLOAD); })); c.on('data', mustCall((data) => { received += data.toString(); })); c.on('end', mustCall(() => { assert.strictEqual( received, 'HTTP/1.1 431 Request Header Fields Too Large\r\n' + 'Connection: close\r\n\r\n' ); c.end(); })); c.on('close', mustCall(() => server.close())); }));