1'use strict'; 2require('../common'); 3const Countdown = require('../common/countdown'); 4 5// This test ensures Node.js doesn't behave erratically when receiving pipelined 6// requests 7// https://github.com/nodejs/node/issues/3332 8 9const http = require('http'); 10const net = require('net'); 11 12const big = Buffer.alloc(16 * 1024, 'A'); 13 14const COUNT = 1e4; 15 16const countdown = new Countdown(COUNT, () => { 17 server.close(); 18 client.end(); 19}); 20 21let client; 22const server = http 23 .createServer(function(req, res) { 24 res.end(big, function() { 25 countdown.dec(); 26 }); 27 }) 28 .listen(0, function() { 29 const req = 'GET / HTTP/1.1\r\n\r\n'.repeat(COUNT); 30 client = net.connect(this.address().port, function() { 31 client.write(req); 32 }); 33 client.resume(); 34 }); 35