[ Web Proxy ]
URL:
Viewing: https://raw.githubusercontent.com/robbles/node/reload/benchmark/http_simple.js [Back]  [Original]

path = require("path");
exec = require("child_process").exec;
http = require("http");

port = parseInt(process.env.PORT || 8000);

console.log('pid ' + process.pid);

fixed = ""
for (var i = 0; i < 20*1024; i++) {
  fixed += "C";
}

var uname, rev;

exec('git rev-list -1 HEAD', function (e, stdout) {
  if (e) {
    console.error("Problem executing: 'git rev-list -1 HEAD'");
    throw new Error(e);
  }
  rev = stdout.replace(/\s/g, '');
});

exec('uname -a', function (e, stdout) {
  if (e) {
    console.error("Problem executing: 'uname -a'");
    throw new Error(e);
  }
  uname = stdout.replace(/[\r\n]/g, '');
});


stored = {};
storedBuffer = {};

var server = http.createServer(function (req, res) {
  var commands = req.url.split("/");
  var command = commands[1];
  var body = "";
  var arg = commands[2];
  var status = 200;

  if (command == "bytes") {
    var n = parseInt(arg, 10)
    if (n 

Web Proxy Viewer  |  New URL  |  Original Page