Skip to content

Commit

Permalink
[api minor debug] Remove debug code, set Connection header if not set
Browse files Browse the repository at this point in the history
  • Loading branch information
indexzero committed Sep 7, 2010
1 parent 9715ebd commit 6d08f24
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions lib/node-http-proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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();
Expand All @@ -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);
});
});
Expand Down

0 comments on commit 6d08f24

Please sign in to comment.