From 5aefc345de84b04a0bd5529830948da4d5c2f547 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Sun, 4 Sep 2022 13:59:47 +0200 Subject: [PATCH] WS UI server: use error on socket destroy MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- src/charging-station/ui-server/UIWebSocketServer.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/charging-station/ui-server/UIWebSocketServer.ts b/src/charging-station/ui-server/UIWebSocketServer.ts index b973cf45..c706cdd9 100644 --- a/src/charging-station/ui-server/UIWebSocketServer.ts +++ b/src/charging-station/ui-server/UIWebSocketServer.ts @@ -72,7 +72,7 @@ export default class UIWebSocketServer extends AbstractUIServer { this.authenticate(req, (err) => { if (err) { socket.write(`HTTP/1.1 ${StatusCodes.UNAUTHORIZED} Unauthorized\r\n\r\n`); - socket.destroy(); + socket.destroy(err); return; } this.webSocketServer.handleUpgrade(req, socket, head, (ws: WebSocket) => { -- 2.34.1