From 03df23e21400db0420a4ec5f64fadf207a0a27a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?b=CA=B0edoh=E2=82=82=20sw=C3=A9?= Date: Wed, 18 Dec 2024 22:32:35 +0500 Subject: [PATCH] Try to fix things once again --- index.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/index.ts b/index.ts index 3879cb6..b8698dc 100644 --- a/index.ts +++ b/index.ts @@ -42,12 +42,13 @@ let srv = net.createServer(function(socket: net.Socket) { socket.on('data', function(data: Buffer | string) { if (data[0] === 'P'.charCodeAt(0)) { if (addr == "127.0.0.1") { - let p = pp.V1ProxyProtocol.parse(String(data)); + let s = String(data); + let p = pp.V1ProxyProtocol.parse(s); addr = p.source.ipAddress; if (typeof p.data === 'undefined') { return; } else { - data = data.slice(p.data.length); + data = data.slice(s.search("\r")); } } else { console.log("Address " + addr + " tried to use proxy protocol.");