From 84949547472e87cf765b7a84b67b81ecab2bd76f Mon Sep 17 00:00:00 2001 From: Laszlo Bacsi Date: Fri, 16 Sep 2011 10:16:04 +0200 Subject: [PATCH] Updated http-proxy to ~> 0.7.0 --- lib/http_server.js | 12 +++++++----- package.json | 2 +- src/http_server.coffee | 4 ++-- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/lib/http_server.js b/lib/http_server.js index 63e3ebe..b6b541e 100644 --- a/lib/http_server.js +++ b/lib/http_server.js @@ -174,7 +174,12 @@ return next(); } _ref2 = url.parse(req.pow.url), hostname = _ref2.hostname, port = _ref2.port; - proxy = new HttpProxy(); + proxy = new HttpProxy({ + target: { + host: hostname, + port: port + } + }); proxy.on('proxyError', function(err, req, res) { return renderResponse(res, 500, "proxy_error", { err: err, @@ -182,10 +187,7 @@ port: port }); }); - proxy.proxyRequest(req, res, { - host: hostname, - port: port - }); + proxy.proxyRequest(req, res); return req.pow.resume(); }; HttpServer.prototype.handleApplicationRequest = function(req, res, next) { diff --git a/package.json b/package.json index ec81d1e..2d69355 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "async": "0.1.8" , "coffee-script": ">= 1.1.0" , "connect": ">= 1.0.3" - , "http-proxy": ">= 0.5.8" + , "http-proxy": "~> 0.7.0" , "log": ">= 1.1.1" , "nack": ">= 0.12.2" , "ndns": ">= 0.1.2" diff --git a/src/http_server.coffee b/src/http_server.coffee index 37084b0..68e8ec0 100644 --- a/src/http_server.coffee +++ b/src/http_server.coffee @@ -179,12 +179,12 @@ module.exports = class HttpServer extends connect.HTTPServer return next() unless req.pow.url {hostname, port} = url.parse req.pow.url - proxy = new HttpProxy() + proxy = new HttpProxy target: {host: hostname, port} proxy.on 'proxyError', (err, req, res) -> renderResponse res, 500, "proxy_error", {err, hostname, port} - proxy.proxyRequest req, res, {host: hostname, port} + proxy.proxyRequest req, res req.pow.resume()