Commit eb39018f authored by indexzero's avatar indexzero

[api] Integrated a little more from Mikeal to make our return headers consistent

parent 6d08f24c
......@@ -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) {
......@@ -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) {
......
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