mirror of
https://github.com/http-party/node-http-proxy.git
synced 2025-12-08 20:59:18 +00:00
added option for eventlistenerCount(max)
This commit is contained in:
parent
1333c0cc62
commit
8eb6780f87
@ -103,6 +103,9 @@ var HttpProxy = exports.HttpProxy = function (options) {
|
||||
? this.enable.xforward
|
||||
: true;
|
||||
|
||||
// if event listener is set then use it else unlimited.
|
||||
this.eventListenerCount = typeof options.eventListenerCount === 'number'? options.eventListenerCount : 0 ;
|
||||
|
||||
//
|
||||
// Setup additional options for WebSocket proxying. When forcing
|
||||
// the WebSocket handshake to change the `sec-websocket-location`
|
||||
@ -371,10 +374,9 @@ HttpProxy.prototype.proxyRequest = function (req, res, buffer) {
|
||||
res.on('drain', ondrain);
|
||||
});
|
||||
|
||||
|
||||
// allow unlimited listeners ...
|
||||
reverseProxy.setMaxListeners(0);
|
||||
|
||||
reverseProxy.setMaxListeners(this.eventListenerCount);
|
||||
|
||||
//
|
||||
// Handle 'error' events from the `reverseProxy`. Setup timeout override if needed
|
||||
//
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user