From 72a25eeadb2068d5ba4938e9f3ea999c132b5e8d Mon Sep 17 00:00:00 2001 From: Iosif Nicolae Date: Fri, 18 Mar 2022 19:08:07 +0200 Subject: [PATCH] Update proxywrap.js --- lib/proxywrap.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/proxywrap.js b/lib/proxywrap.js index d2f24c1..05e1a21 100644 --- a/lib/proxywrap.js +++ b/lib/proxywrap.js @@ -126,6 +126,15 @@ exports.proxy = function(iface, options) { this.removeAllListeners('connection') this.addListener('connection', connectionListener) + const t = this; + + this.on = (event, handler) => { + if(event === 'connection') { + return this.addListener('proxiedConnection', handler); + } + return t.addListener(event, handler); + } + // add the old connection listeners to a custom event, which we'll fire after processing the PROXY header for (var i = 0; i < cl.length; i++) { this.addListener('proxiedConnection', cl[i])