1 path = require("path");
3 var puts = require("sys").puts;
5 var old = (process.argv[2] == 'old');
7 http = require(old ? "http_old" : 'http');
8 if (old) puts('old version');
11 for (var i = 0; i < 20*1024; i++) {
17 http.createServer(function (req, res) {
18 var commands = req.url.split("/");
19 var command = commands[1];
21 var arg = commands[2];
24 if (command == "bytes") {
25 var n = parseInt(arg, 10)
27 throw "bytes called with n <= 0"
28 if (stored[n] === undefined) {
29 puts("create stored[n]");
31 for (var i = 0; i < n; i++) {
37 } else if (command == "quit") {
38 res.connection.server.close();
41 } else if (command == "fixed") {
49 var content_length = body.length.toString();
52 , { "Content-Type": "text/plain"
53 , "Content-Length": content_length
57 res.write(body, 'ascii');
60 res.end(body, 'ascii');