<commit_before>var http = require('http');
servers = require('./servers').Servers;
var p = function(request, response, proxy) {
	if(proxy === null) {
		response.writeHead(500, {
			'Content-Type' : 'text/plain'
		});
		response.write(' ');
		response.end('no server available');
		return;
	}
	
	var proxy_request = http.request({
		host : proxy.host,
		headers: request.headers,
		port : proxy.port,
		path : request.url,
		method : request.method
	}, function(proxy_response) {
		proxy_response.addListener('data', function(chunk) {
			response.write(chunk, 'binary');
		});
		proxy_response.addListener('end', function() {
			proxy.setSuccess();
			response.end();
		});
	});
	request.addListener('data', function(chunk) {
		proxy_request.write(chunk, 'binary');
	});
	request.addListener('end', function(err, res) {
		proxy_request.end();
	});
	proxy_request.on('error', function(err, res) {
		response.writeHead(500, {
			'Content-Type' : 'text/plain'
		});
		response.write();
		response.end('error');
		proxy.setFailed(err,res);
		response.end();
	});
}
module.exports.p = p<commit_msg>fix missing headers on response<commit_after>var http = require('http');
servers = require('./servers').Servers;
var p = function(request, response, proxy) {
	if(proxy === null) {
		response.writeHead(500, {
			'Content-Type' : 'text/plain'
		});
		response.write(' ');
		response.end('no server available');
		return;
	}

	var proxy_request = http.request({
		host : proxy.host,
		headers : request.headers,
		port : proxy.port,
		path : request.url,
		method : request.method
	}, function(proxy_response) {
		proxy_response.addListener('data', function(chunk) {
			response.write(chunk, 'binary');
		});
		proxy_response.addListener('end', function() {
			proxy.setSuccess();
			response.end();
		});
		response.statusCode = proxy_response.statusCode;
		for(k in proxy_response.headers) {
			response.setHeader(k, proxy_response.headers[k]);
		}
	});
	request.addListener('data', function(chunk) {
		proxy_request.write(chunk, 'binary');
	});
	request.addListener('end', function(err, res) {
		proxy_request.end();
	});
	proxy_request.on('error', function(err, res) {
		response.writeHead(500, {
			'Content-Type' : 'text/plain'
		});
		response.write();
		response.end('error');
		proxy.setFailed(err, res);
		response.end();
	});
}
module.exports.p = p
{'fraction_non_alphanumeric': 0.18100511073253833, 'fraction_numerical': 0.005110732538330494, 'mean_word_length': 4.462790697674419, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1114859', 'n_tokens_mistral': 862, 'n_tokens_neox': 785, 'n_words': 135}