Skip to content

Commit

Permalink
[api] Integrated a little more from Mikeal to make our return headers…
Browse files Browse the repository at this point in the history
… consistent
  • Loading branch information
indexzero committed Sep 7, 2010
1 parent 6d08f24 commit eb39018
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/node-http-proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ 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 Down Expand Up @@ -113,6 +112,11 @@ var createProxy = function () {

// Add a listener for the reverse_proxy response event
reverse_proxy.addListener('response', function (response) {
if (response.headers.connection) {
if (req.headers.connection) response.headers.connection = req.headers.connection;
else response.headers.connection = 'close';
}

// These two listeners are for testability and observation
// of what's passed back from the target server
response.addListener('data', function (chunk) {
Expand Down

0 comments on commit eb39018

Please sign in to comment.