1 path = require("path");
3 var puts = require("sys").puts;
5 var old = (process.argv[2] == 'old');
7 puts('pid ' + process.pid);
9 http = require(old ? "http_old" : 'http');
10 if (old) puts('old version');
13 for (var i = 0; i < 20*1024; i++) {
19 http.createServer(function (req, res) {
20 var commands = req.url.split("/");
21 var command = commands[1];
23 var arg = commands[2];
26 if (command == "bytes") {
27 var n = parseInt(arg, 10)
29 throw "bytes called with n <= 0"
30 if (stored[n] === undefined) {
31 puts("create stored[n]");
33 for (var i = 0; i < n; i++) {
39 } else if (command == "quit") {
40 res.connection.server.close();
43 } else if (command == "fixed") {
51 var content_length = body.length.toString();
54 , { "Content-Type": "text/plain"
55 , "Content-Length": content_length
59 res.write(body, 'ascii');
62 res.end(body, 'ascii');