Skip to content

Commit

Permalink
Revert "[fix] fixed passes functions, now 'this' can be used and opti…
Browse files Browse the repository at this point in the history
…ons are stored on 'this.options'"

This reverts commit 9b3e1eb.
  • Loading branch information
cronopio committed Oct 21, 2013
1 parent babdf53 commit 5e130de
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
9 changes: 4 additions & 5 deletions lib/http-proxy/passes/ws-incoming.js
Expand Up @@ -64,13 +64,12 @@ var passes = exports;
*
* @param {ClientRequest} Req Request object
* @param {Socket} Websocket
* @param {Object} Options Config object passed to the proxy
*
* @api private
*/

function XHeaders(req, socket) {
// Now the options are stored on this
var options = this.options;
function XHeaders(req, socket, options) {
if(!options.xfwd) return;

var values = {
Expand All @@ -93,11 +92,11 @@ var passes = exports;
*
* @param {ClientRequest} Req Request object
* @param {Socket} Websocket
* @param {Object} Options Config object passed to the proxy
*
* @api private
*/
function stream(req, socket, head, clb) {
var server = this;
function stream(req, socket, server, head, clb) {
common.setupSocket(socket);

if (head && head.length) socket.unshift(head);
Expand Down
8 changes: 4 additions & 4 deletions test/lib-http-proxy-test.js
Expand Up @@ -122,7 +122,7 @@ describe('lib/http-proxy.js', function() {
proxy.on('error', function (err) {
expect(err).to.be.an(Error);
expect(err.code).to.be('ECONNREFUSED');
proxy._server.close();
proxyServer._server.close();
done();
})

Expand All @@ -148,7 +148,9 @@ describe('lib/http-proxy.js', function() {
setTimeout(function () {
res.end('At this point the socket should be closed');
}, 5)
}).listen('8080');
});

source.listen('8080');

var testReq = http.request({
hostname: '127.0.0.1',
Expand All @@ -159,8 +161,6 @@ describe('lib/http-proxy.js', function() {
testReq.on('error', function (e) {
expect(e).to.be.an(Error);
expect(e.code).to.be.eql('ECONNRESET');
proxy._server.close();
source.close();
done();
});

Expand Down

0 comments on commit 5e130de

Please sign in to comment.