Commit 6d08f24c authored by indexzero's avatar indexzero

[api minor debug] Remove debug code, set Connection header if not set

parent 9715ebd4
......@@ -81,6 +81,7 @@ var createProxy = function () {
server.emit('route', req, res, function (port, hostname) {
var p = manager.getPool(port, hostname);
req.headers.Connection = req.headers.Connection || 'close';
p.request(req.method, req.url, req.headers, function (reverse_proxy) {
var data = '';
reverse_proxy.on('error', function (err) {
......@@ -103,12 +104,8 @@ var createProxy = function () {
sys.pump(req, reverse_proxy);
if (e) {
sys.puts('end outgoing request');
req.removeListener('end', e);
req.addListener('end', function () {
sys.puts('request ended');
reverse_proxy.end()
});
req.addListener('end', function () { reverse_proxy.end() });
}
else {
reverse_proxy.end();
......@@ -125,10 +122,10 @@ var createProxy = function () {
response.addListener('end', function() {
server.emit('proxy', null, data);
});
sys.puts('response');
// Set the response headers of the client response
res.writeHead(response.statusCode, response.headers);
sys.pump(response, res);
});
});
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment