2020-01-16 19:55:52 +00:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
const common = require('../common');
|
|
|
|
|
|
|
|
// Test https://hackerone.com/reports/735748 is fixed.
|
|
|
|
|
|
|
|
const assert = require('assert');
|
|
|
|
const http = require('http');
|
|
|
|
const net = require('net');
|
|
|
|
|
|
|
|
const REQUEST_BB = `POST / HTTP/1.1
|
|
|
|
Content-Type: text/plain; charset=utf-8
|
|
|
|
Host: hacker.exploit.com
|
|
|
|
Connection: keep-alive
|
|
|
|
Content-Length: 10
|
2022-07-06 12:56:27 +00:00
|
|
|
Transfer-Encoding: eee, chunked
|
2020-01-16 19:55:52 +00:00
|
|
|
|
|
|
|
HELLOWORLDPOST / HTTP/1.1
|
|
|
|
Content-Type: text/plain; charset=utf-8
|
|
|
|
Host: hacker.exploit.com
|
|
|
|
Connection: keep-alive
|
|
|
|
Content-Length: 28
|
|
|
|
|
|
|
|
I AM A SMUGGLED REQUEST!!!
|
|
|
|
`;
|
|
|
|
|
|
|
|
const server = http.createServer(common.mustNotCall());
|
|
|
|
|
|
|
|
server.on('clientError', common.mustCall((err) => {
|
2023-09-16 11:08:18 +00:00
|
|
|
assert.strictEqual(err.code, 'HPE_INVALID_TRANSFER_ENCODING');
|
2020-01-16 19:55:52 +00:00
|
|
|
server.close();
|
|
|
|
}));
|
|
|
|
|
|
|
|
server.listen(0, common.mustCall(() => {
|
|
|
|
const client = net.connect(
|
|
|
|
server.address().port,
|
|
|
|
common.mustCall(() => {
|
|
|
|
client.end(REQUEST_BB.replace(/\n/g, '\r\n'));
|
|
|
|
}));
|
|
|
|
}));
|