| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent f25760c commit 93a098c
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,5 +1,3 @@ | |||
| 1 | - // Flags: --expose-internals | ||
| 2 | - | ||
| 3 | 1 | 'use strict'; | |
| 4 | 2 | const { expectsError, mustCall } = require('../common'); | |
| 5 | 3 | const assert = require('assert'); | |
@@ -10,11 +8,10 @@ const CRLF = '\r\n'; | |||
| 10 | 8 | const DUMMY_HEADER_NAME = 'Cookie: '; | |
| 11 | 9 | const DUMMY_HEADER_VALUE = 'a'.repeat( | |
| 12 | 10 | // Plus one is to make it 1 byte too big | |
| 13 | - maxHeaderSize - DUMMY_HEADER_NAME.length + 2 | ||
| 11 | + maxHeaderSize - DUMMY_HEADER_NAME.length + 1 | ||
| 14 | 12 | ); | |
| 15 | 13 | const PAYLOAD_GET = 'GET /blah HTTP/1.1'; | |
| 16 | - const PAYLOAD = PAYLOAD_GET + CRLF + | ||
| 17 | - DUMMY_HEADER_NAME + DUMMY_HEADER_VALUE + CRLF.repeat(2); | ||
| 14 | + const PAYLOAD = PAYLOAD_GET + CRLF + DUMMY_HEADER_NAME + DUMMY_HEADER_VALUE; | ||
| 18 | 15 | ||
| 19 | 16 | const server = createServer(); | |
| 20 | 17 | ||
@@ -23,18 +20,19 @@ server.on('connection', mustCall((socket) => { | |||
| 23 | 20 | name: 'Error', | |
| 24 | 21 | message: 'Parse Error: Header overflow', | |
| 25 | 22 | code: 'HPE_HEADER_OVERFLOW', | |
| 26 | - bytesParsed: maxHeaderSize + PAYLOAD_GET.length + (CRLF.length * 2) + 1, | ||
| 23 | + bytesParsed: PAYLOAD.length, | ||
| 27 | 24 | rawPacket: Buffer.from(PAYLOAD) | |
| 28 | 25 | })); | |
| 26 | + | ||
| 27 | + // The data is not sent from the client to ensure that it is received as a | ||
| 28 | + // single chunk. | ||
| 29 | + socket.push(PAYLOAD); | ||
| 29 | 30 | })); | |
| 30 | 31 | ||
| 31 | 32 | server.listen(0, mustCall(() => { | |
| 32 | 33 | const c = createConnection(server.address().port); | |
| 33 | 34 | let received = ''; | |
| 34 | 35 | ||
| 35 | - c.on('connect', mustCall(() => { | ||
| 36 | - c.write(PAYLOAD); | ||
| 37 | - })); | ||
| 38 | 36 | c.on('data', mustCall((data) => { | |
| 39 | 37 | received += data.toString(); | |
| 40 | 38 | })); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments