From 6732e7fa1794d49078ac34fd0541dfa77c1df36d Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Tue, 13 Apr 2010 16:22:12 -0700 Subject: [PATCH] Add big proxy failing test GH-77. Code by Robert Newson --- test/pummel/test-http-big-proxy-responses.js | 63 ++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 test/pummel/test-http-big-proxy-responses.js diff --git a/test/pummel/test-http-big-proxy-responses.js b/test/pummel/test-http-big-proxy-responses.js new file mode 100644 index 0000000000..c95b70cfc2 --- /dev/null +++ b/test/pummel/test-http-big-proxy-responses.js @@ -0,0 +1,63 @@ +require('../common'); +var sys = require("sys"), +fs = require("fs"), +http = require("http"), +url = require("url"); + +// Produce a very large response. +var chargen = http.createServer(function (req, res) { + var chunk = '01234567890123456789'; + var len = req.headers['x-len']; + res.writeHead(200, {"transfer-encoding":"chunked"}); + for (var i=0; i 0) { + sys.debug("calling chargen for " + list[0] + " chunks."); + var req = http.createClient(9001, 'localhost').request('/', {'x-len': list[0]}); + req.addListener('response', function(res) { + res.addListener('end', function() { + sys.debug("end for " + list[0] + " chunks."); + list.shift(); + call_chargen(list); + }); + }); + req.end(); + } + else { + sys.puts("End of list."); + proxy.end(); + chargen.end(); + done = true; + } +} + +call_chargen([ 100, 1000, 10000, 100000, 1000000 ]); + +process.addListener('exit', function () { + assert.ok(done); +});