From 492134f830678f071a0e4915421b48fd4703d89f Mon Sep 17 00:00:00 2001 From: yawnt Date: Mon, 24 Jun 2013 12:17:52 +0200 Subject: [PATCH] [fix] typo --- lib/node-http-proxy/http-proxy.js | 14 +++++++------- lib/node-http-proxy/streams/forward.js | 3 ++- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/lib/node-http-proxy/http-proxy.js b/lib/node-http-proxy/http-proxy.js index d766919..8b9ef4a 100644 --- a/lib/node-http-proxy/http-proxy.js +++ b/lib/node-http-proxy/http-proxy.js @@ -24,11 +24,12 @@ */ -var events = require('events'), - http = require('http'), - util = require('util'), - url = require('url'), - httpProxy = require('../node-http-proxy'); +var events = require('events'), + http = require('http'), + util = require('util'), + url = require('url'), + ForwardStream = require('./streams/forward'), + httpProxy = require('../node-http-proxy'); // // ### function HttpProxy (options) @@ -97,7 +98,6 @@ var HttpProxy = exports.HttpProxy = function (options) { this.enable.xforward = true; } - // // Setup additional options for WebSocket proxying. When forcing // the WebSocket handshake to change the `sec-websocket-location` @@ -170,7 +170,7 @@ HttpProxy.prototype.proxyRequest = function (req, res, buffer) { // if (this.forward) { this.emit('forward', req, res, this.forward); - this._forwardRequest(req); + req.pipe(new ForwardStream(this.forward)); } // diff --git a/lib/node-http-proxy/streams/forward.js b/lib/node-http-proxy/streams/forward.js index ff494e4..c292517 100644 --- a/lib/node-http-proxy/streams/forward.js +++ b/lib/node-http-proxy/streams/forward.js @@ -31,7 +31,8 @@ var ForwardStream = module.exports = function ForwardStream(options) { outgoing[elem] = req[elem]; }); - self.request = protocol.request(outgoing) + // pipe throw-safe? do we need to add a ` on 'error' ` handler? + self.request = protocol.request(outgoing, function() {}); }); };