11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_ci 31cb0ef41Sopenharmony_ciconst common = require('../common'); 41cb0ef41Sopenharmony_ci 51cb0ef41Sopenharmony_ci// Test https://hackerone.com/reports/735748 is fixed. 61cb0ef41Sopenharmony_ci 71cb0ef41Sopenharmony_ciconst assert = require('assert'); 81cb0ef41Sopenharmony_ciconst http = require('http'); 91cb0ef41Sopenharmony_ciconst net = require('net'); 101cb0ef41Sopenharmony_ci 111cb0ef41Sopenharmony_ciconst REQUEST_BB = `POST / HTTP/1.1 121cb0ef41Sopenharmony_ciContent-Type: text/plain; charset=utf-8 131cb0ef41Sopenharmony_ciHost: hacker.exploit.com 141cb0ef41Sopenharmony_ciConnection: keep-alive 151cb0ef41Sopenharmony_ciContent-Length: 10 161cb0ef41Sopenharmony_ciTransfer-Encoding: eee, chunked 171cb0ef41Sopenharmony_ci 181cb0ef41Sopenharmony_ciHELLOWORLDPOST / HTTP/1.1 191cb0ef41Sopenharmony_ciContent-Type: text/plain; charset=utf-8 201cb0ef41Sopenharmony_ciHost: hacker.exploit.com 211cb0ef41Sopenharmony_ciConnection: keep-alive 221cb0ef41Sopenharmony_ciContent-Length: 28 231cb0ef41Sopenharmony_ci 241cb0ef41Sopenharmony_ciI AM A SMUGGLED REQUEST!!! 251cb0ef41Sopenharmony_ci`; 261cb0ef41Sopenharmony_ci 271cb0ef41Sopenharmony_ciconst server = http.createServer(common.mustNotCall()); 281cb0ef41Sopenharmony_ci 291cb0ef41Sopenharmony_ciserver.on('clientError', common.mustCall((err) => { 301cb0ef41Sopenharmony_ci assert.strictEqual(err.code, 'HPE_UNEXPECTED_CONTENT_LENGTH'); 311cb0ef41Sopenharmony_ci server.close(); 321cb0ef41Sopenharmony_ci})); 331cb0ef41Sopenharmony_ci 341cb0ef41Sopenharmony_ciserver.listen(0, common.mustCall(() => { 351cb0ef41Sopenharmony_ci const client = net.connect( 361cb0ef41Sopenharmony_ci server.address().port, 371cb0ef41Sopenharmony_ci common.mustCall(() => { 381cb0ef41Sopenharmony_ci client.end(REQUEST_BB.replace(/\n/g, '\r\n')); 391cb0ef41Sopenharmony_ci })); 401cb0ef41Sopenharmony_ci})); 41