diff options
author | Ben Noordhuis <info@bnoordhuis.nl> | 2011-08-17 20:39:20 +0200 |
---|---|---|
committer | Ben Noordhuis <info@bnoordhuis.nl> | 2011-08-17 20:39:20 +0200 |
commit | d72c6940f8b339a073979129fcc5a8cd3623aa2d (patch) | |
tree | acaa9d77fa025248e44c9e3747237e404826184a /benchmark | |
parent | 4cf931db1736a73717f4e6b9f11c3450de8606c6 (diff) | |
download | android-node-v8-d72c6940f8b339a073979129fcc5a8cd3623aa2d.tar.gz android-node-v8-d72c6940f8b339a073979129fcc5a8cd3623aa2d.tar.bz2 android-node-v8-d72c6940f8b339a073979129fcc5a8cd3623aa2d.zip |
bench: make http_simple send chunked encoding if requested
Diffstat (limited to 'benchmark')
-rw-r--r-- | benchmark/http_simple.js | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/benchmark/http_simple.js b/benchmark/http_simple.js index 8d66190e0f..300bf14450 100644 --- a/benchmark/http_simple.js +++ b/benchmark/http_simple.js @@ -39,6 +39,7 @@ var server = http.createServer(function (req, res) { var command = commands[1]; var body = ""; var arg = commands[2]; + var chunked = (commands[3] === "chunked"); var status = 200; if (command == "bytes") { @@ -81,10 +82,16 @@ var server = http.createServer(function (req, res) { body = "not found\n"; } - var content_length = body.length.toString(); + if (chunked) { + res.writeHead(status, { "Content-Type": "text/plain", + "Transfer-Encoding": "chunked" }); + } else { + var content_length = body.length.toString(); + + res.writeHead(status, { "Content-Type": "text/plain", + "Content-Length": content_length }); + } - res.writeHead(status, { "Content-Type": "text/plain", - "Content-Length": content_length }); res.end(body); }); |