Sha256: e4f30499e45131f73b55eb295872a7435964aa7284b3e55f3b37733aee6026bf

Contents?: true

Size: 901 Bytes

Versions: 2

Compression:

Stored size: 901 Bytes

Contents

'use strict';

var path = require('path');
var http = require('http');
var fs = require('fs');
var fork = require('child_process').fork;
var common = require('../common.js');
var test = require('../../test/common.js');
var pep = path.dirname(process.argv[1]) + '/_chunky_http_client.js';
var PIPE = test.PIPE;

try {
  fs.accessSync(test.tmpDir, fs.F_OK);
} catch (e) {
  fs.mkdirSync(test.tmpDir);
}

var server;
try {
  fs.unlinkSync(PIPE);
} catch (e) { /* ignore */ }

server = http.createServer(function(req, res) {
  var headers = {
    'content-type': 'text/plain',
    'content-length': '2'
  };
  res.writeHead(200, headers);
  res.end('ok');
});

server.on('error', function(err) {
  throw new Error('server error: ' + err);
});

server.listen(PIPE);

var child = fork(pep, process.argv.slice(2));
child.on('message', common.sendResult);
child.on('close', function() {
  server.close();
});

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
node-compiler-0.9.1 vendor/node/benchmark/http/http_server_for_chunky_client.js
node-compiler-0.9.0 vendor/node-v7.2.1/benchmark/http/http_server_for_chunky_client.js