<commit_before>var async         = require('async');
var cluster       = require('cluster');
var cookieParser  = require('cookie-parser')();
var fileServer    = require('node-static');
var forwarded     = require('forwarded-for');
var http          = require('http');
var microtime     = require('microtime-nodejs');
var multiparty    = require('multiparty');
var querystring   = require('querystring');
var url           = require('url');
var fServer       = new fileServer.Server('/', { cache: 7800, serverInfo: 'OrangeBox'});

var statics       = [];
var staticPath    = [];
var aliases       = {};
var engines       = {swig: require('swig')};

String.prototype.hCapitalize = function () {
	return this.split('-').map(
		function (el, i) {
			return el.charAt(0).toUpperCase() + el.substring(1);
		}
	).join('-');
};


function processRequest (request) {
	var host = request.headers.host.split(':');
	if (host[0]) request.host = host[0];
	if (host[1]) request.port = host[1];

	var query = request.url.split('?');
	var path = query[0];
	query.splice(0,1);

	// request.ip = req.header('x-forwarded-for') || req.headers['X-Forwarded-For'] || req.client.remoteAddress;
	request.ip = forwarded(request, request.headers).ip;

	request.query = querystring.parse(query.join('?'));
	request.queryString = query.join('?');
	request.path = path;

	// aliases
	for (var a in aliases) {
		if (request.path.indexOf(a) === 0)  {
			request.originalUrl = request.url;
			request.url = request.path.replace(a, aliases[a]) + (request.queryString.length ? '?' + request.queryString : '');
		}
	}
}

function processPost (request, response, callback) {
	var queryData = '';
	if (typeof callback !== 'function') return;

	if (request.method == 'POST') {
		var mpart = false;
		if (typeof request.headers["content-type"] === 'string' &&
		 request.headers["content-type"].indexOf('multipart/form-data') !== -1) {
			var form = new multiparty.Form();
			form.parse(request, function(err, body, files) {
				request.body = body;
				request.files = files;
				callback();
			});
		} else {
			request.on('data', function(data) {
				queryData += data;
				if(queryData.length > 1e6) {
					queryData = '';
					response.writeHead(413, {'Content-Type': 'text/plain'}).end();<commit_msg>Removed unused variable<commit_after>var async         = require('async');
var cluster       = require('cluster');
var cookieParser  = require('cookie-parser')();
var fileServer    = require('node-static');
var forwarded     = require('forwarded-for');
var http          = require('http');
var microtime     = require('microtime-nodejs');
var multiparty    = require('multiparty');
var querystring   = require('querystring');
var url           = require('url');
var fServer       = new fileServer.Server('/', { cache: 7800, serverInfo: 'OrangeBox'});

var statics       = [];
var staticPath    = [];
var aliases       = {};
var engines       = {swig: require('swig')};

String.prototype.hCapitalize = function () {
	return this.split('-').map(
		function (el, i) {
			return el.charAt(0).toUpperCase() + el.substring(1);
		}
	).join('-');
};


function processRequest (request) {
	var host = request.headers.host.split(':');
	if (host[0]) request.host = host[0];
	if (host[1]) request.port = host[1];

	var query = request.url.split('?');
	var path = query[0];
	query.splice(0,1);

	// request.ip = req.header('x-forwarded-for') || req.headers['X-Forwarded-For'] || req.client.remoteAddress;
	request.ip = forwarded(request, request.headers).ip;

	request.query = querystring.parse(query.join('?'));
	request.queryString = query.join('?');
	request.path = path;

	// aliases
	for (var a in aliases) {
		if (request.path.indexOf(a) === 0)  {
			request.originalUrl = request.url;
			request.url = request.path.replace(a, aliases[a]) + (request.queryString.length ? '?' + request.queryString : '');
		}
	}
}

function processPost (request, response, callback) {
	var queryData = '';
	if (typeof callback !== 'function') return;

	if (request.method == 'POST') {
		if (typeof request.headers["content-type"] === 'string' &&
		 request.headers["content-type"].indexOf('multipart/form-data') !== -1) {
			var form = new multiparty.Form();
			form.parse(request, function(err, body, files) {
				request.body = body;
				request.files = files;
				callback();
			});
		} else {
			request.on('data', function(data) {
				queryData += data;
				if(queryData.length > 1e6) {
					queryData = '';
					response.writeHead(413, {'Content-Type': 'text/plain'}).end();
{'fraction_non_alphanumeric': 0.18624198186241983, 'fraction_numerical': 0.008847600088476001, 'mean_word_length': 3.6763185108583247, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4904755', 'n_tokens_mistral': 1591, 'n_tokens_neox': 1459, 'n_words': 312}